Completed
Push — add/instant-search-results-in-... ( e5091e )
by
unknown
286:38 queued 279:09
created

search-results.php ➔ render_block()   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 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Search Results Block
4
 *
5
 * @since 8.9.0
6
 *
7
 * @package Jetpack
8
 */
9
10
namespace Automattic\Jetpack\Extensions\Search_Results;
11
12
use Jetpack_Gutenberg;
13
14
const FEATURE_NAME = 'search-results';
15
const BLOCK_NAME   = 'jetpack/' . FEATURE_NAME;
16
17
/**
18
 * Registers the block for use in Gutenberg
19
 * This is done via an action so that we can disable
20
 * registration if we need to.
21
 */
22
function register_block() {
23
	jetpack_register_block(
24
		BLOCK_NAME,
25
		array( 'render_callback' => __NAMESPACE__ . '\render_block' )
26
	);
27
}
28
add_action( 'init', __NAMESPACE__ . '\register_block' );
29
30
/**
31
 * Repeat Visitor block dependency declaration.
32
 *
33
 * @param array  $attributes Array containing the block attributes.
34
 * @param string $content    String containing the block content.
35
 *
36
 * @return string
37
 */
38
function render_block( $attributes, $content ) {
39
	Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME );
40
	return $content;
41
42
	// $classes = Jetpack_Gutenberg::block_classes( FEATURE_NAME, $attributes );
43
	// return an empty div so that view script increments the visit counter in the cookie.
44
	// return '<div class="' . esc_attr( $classes ) . '"></div>';
45
}
46