Completed
Push — try/search-config-via-block ( adc05e )
by
unknown
73:49 queued 61:57
created

search-config.php ➔ load_assets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Search-config Block.
4
 *
5
 * @since 9.x
6
 *
7
 * @package automattic/jetpack
8
 */
9
10
namespace Automattic\Jetpack\Extensions\Search_config;
11
12
use Automattic\Jetpack\Blocks;
13
use Jetpack_Gutenberg;
14
15
const FEATURE_NAME = 'search-config';
16
const BLOCK_NAME   = 'jetpack/' . FEATURE_NAME;
17
18
/**
19
 * Registers the block for use in Gutenberg
20
 * This is done via an action so that we can disable
21
 * registration if we need to.
22
 */
23
function register_block() {
24
	Blocks::jetpack_register_block(
25
		BLOCK_NAME,
26
		array( 'render_callback' => __NAMESPACE__ . '\load_assets' )
27
	);
28
}
29
add_action( 'init', __NAMESPACE__ . '\register_block' );
30
31
/**
32
 * Search-config block registration/dependency declaration.
33
 *
34
 * @return string
35
 */
36
function load_assets() {
37
	/*
38
	 * Enqueue necessary scripts and styles.
39
	 */
40
	Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME );
41
42
	return '';
43
}
44