Completed
Push — update/mailchimp-ui-changes ( f4a7d6...e71283 )
by
unknown
11:27
created

tiled-gallery.php ➔ jetpack_tiled_gallery_load_block_assets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
1
<?php
2
/**
3
 * Tiled Gallery block. Depends on the Photon module.
4
 *
5
 * @since 6.9.0
6
 *
7
 * @package Jetpack
8
 */
9
10
if (
11
	( defined( 'IS_WPCOM' ) && IS_WPCOM ) ||
12
	class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' )
13
) {
14
	register_block_type(
15
		'jetpack/tiled-gallery',
16
		array(
17
			'render_callback' => 'jetpack_tiled_gallery_load_block_assets',
18
		)
19
	);
20
21
	/**
22
	 * Tiled gallery block registration/dependency declaration.
23
	 *
24
	 * @param array  $attr    Array containing the block attributes.
25
	 * @param string $content String containing the block content.
26
	 *
27
	 * @return string
28
	 */
29
	function jetpack_tiled_gallery_load_block_assets( $attr, $content ) {
30
		$dependencies = array(
31
			'lodash',
32
			'wp-i18n',
33
			'wp-token-list',
34
		);
35
		Jetpack_Gutenberg::load_assets_as_required( 'tiled-gallery', $dependencies );
36
37
		/**
38
		 * Filter the output of the Tiled Galleries content.
39
		 *
40
		 * @module tiled-gallery
41
		 *
42
		 * @since 6.9.0
43
		 *
44
		 * @param string $content Tiled Gallery block content.
45
		 */
46
		return apply_filters( 'jetpack_tiled_galleries_block_content', $content );
47
	}
48
}
49