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

send-a-message.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
 * Send a Message Block.
4
 *
5
 * @package Jetpack
6
 */
7
8
namespace Automattic\Jetpack\Extensions\Send_A_Message;
9
10
require_once dirname( __FILE__ ) . '/whatsapp-button/whatsapp-button.php';
11
12
use Jetpack;
13
use Jetpack_Gutenberg;
14
15
const FEATURE_NAME = 'send-a-message';
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
	jetpack_register_block(
25
		BLOCK_NAME,
26
		array(
27
			'render_callback' => __NAMESPACE__ . '\render_block',
28
			'plan_check'      => true,
29
		)
30
	);
31
}
32
add_action( 'init', __NAMESPACE__ . '\register_block' );
33
34
/**
35
 * Render callback.
36
 *
37
 * @param array  $attributes Array containing the block attributes.
38
 * @param string $content    String containing the block content.
39
 *
40
 * @return string
41
 */
42
function render_block( $attributes, $content ) {
43
	Jetpack_Gutenberg::load_styles_as_required( FEATURE_NAME );
44
45
	return $content;
46
}
47