Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | n/a |
0 / 0 |
|
| Automattic\Jetpack\Extensions\Blogging_Prompt\register_block | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
20 | |||
| Automattic\Jetpack\Extensions\Blogging_Prompt\load_assets | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Blogging Prompt Block. |
| 4 | * |
| 5 | * @since 11.x |
| 6 | * |
| 7 | * @package automattic/jetpack |
| 8 | */ |
| 9 | |
| 10 | namespace Automattic\Jetpack\Extensions\Blogging_Prompt; |
| 11 | |
| 12 | use Automattic\Jetpack\Blocks; |
| 13 | use Jetpack_Gutenberg; |
| 14 | |
| 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | exit( 0 ); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Registers the block for use in Gutenberg |
| 21 | * This is done via an action so that we can disable |
| 22 | * registration if we need to. |
| 23 | */ |
| 24 | function register_block() { |
| 25 | if ( ( defined( 'IS_WPCOM' ) && IS_WPCOM ) || \Jetpack::is_connection_ready() ) { |
| 26 | Blocks::jetpack_register_block( |
| 27 | __DIR__, |
| 28 | array( 'render_callback' => __NAMESPACE__ . '\load_assets' ) |
| 29 | ); |
| 30 | } |
| 31 | } |
| 32 | add_action( 'init', __NAMESPACE__ . '\register_block' ); |
| 33 | |
| 34 | /** |
| 35 | * Blogging Prompt block registration/dependency declaration. |
| 36 | * |
| 37 | * @param array $attr Array containing the Blogging Prompt block attributes. |
| 38 | * @param string $content String containing the Blogging Prompt block content. |
| 39 | * |
| 40 | * @return string |
| 41 | */ |
| 42 | function load_assets( $attr, $content ) { |
| 43 | /* |
| 44 | * Enqueue necessary scripts and styles. |
| 45 | */ |
| 46 | Jetpack_Gutenberg::load_assets_as_required( __DIR__ ); |
| 47 | |
| 48 | return $content; |
| 49 | } |