Completed
Push — update/changelog-dev ( f4e081 )
by
unknown
38:24 queued 29:59
created

changelog.php ➔ render_block()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Changelog Block.
4
 *
5
 * @since 9.x
6
 *
7
 * @package Jetpack
8
 */
9
10
namespace Automattic\Jetpack\Extensions\Changelog;
11
12
use Automattic\Jetpack\Blocks;
13
use Jetpack_Gutenberg;
14
15
const FEATURE_NAME = 'changelog';
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(
27
			'render_callback' => __NAMESPACE__ . '\render_block',
28
		)
29
	);
30
}
31
add_action( 'init', __NAMESPACE__ . '\register_block' );
32
33
/**
34
 * Changelog block registration/dependency declaration.
35
 *
36
 * @param array  $attr    Array containing the Changelog block attributes.
37
 * @param string $content String containing the Changelog block content.
38
 *
39
 * @return string
40
 */
41
function render_block( $attr, $content ) {
42
	Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME );
43
	return $content;
44
}
45