Completed
Push — add/termination-dialog-survey ( d3a260...a01abd )
by Jeremy
07:39
created

podcast-episodes.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 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Podcast Episodes Block.
4
 *
5
 * @since 8.x
6
 *
7
 * @package Jetpack
8
 */
9
10
namespace Jetpack\Podcast_Episodes_Block;
11
12
const FEATURE_NAME = 'podcast-episodes';
13
const BLOCK_NAME   = 'jetpack/' . FEATURE_NAME;
14
15
/**
16
 * Registers the block for use in Gutenberg
17
 * This is done via an action so that we can disable
18
 * registration if we need to.
19
 */
20
function register_block() {
21
	jetpack_register_block(
22
		BLOCK_NAME,
23
		array( 'render_callback' => __NAMESPACE__ . '\load_assets' )
24
	);
25
}
26
add_action( 'init', __NAMESPACE__ . '\register_block' );
27
28
/**
29
 * Podcast Episodes block registration/dependency declaration.
30
 *
31
 * @param array  $attr    Array containing the Podcast Episodes block attributes.
32
 * @param string $content String containing the Podcast Episodes block content.
33
 *
34
 * @return string
35
 */
36
function load_assets( $attr, $content ) {
37
	/*
38
	 * Enqueue necessary scripts and styles.
39
	 */
40
	\Jetpack_Gutenberg::load_assets_as_required( 'podcast-episodes' );
41
42
	return $content;
43
}
44