Completed
Push — renovate/dealerdirect-phpcodes... ( e7e821...e6cc4c )
by
unknown
95:47 queued 87:17
created

whatsapp-button.php ➔ render_block()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * WhatsApp Button Block.
4
 *
5
 * @package Jetpack
6
 */
7
8
namespace Automattic\Jetpack\Extensions\WhatsApp_Button;
9
10
use Jetpack;
11
use Jetpack_Gutenberg;
12
13
const PARENT_NAME  = 'send-a-message';
14
const FEATURE_NAME = 'whatsapp-button';
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
 * Render callback.
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_styles_as_required( PARENT_NAME . '/' . FEATURE_NAME );
40
41
	return $content;
42
}
43