← All changes
|
extensions/blocks/blogging-prompt/blogging-prompt.php
+9
-7
13.2.4
→
16.3
View file →
| @@ -9,10 +9,13 @@ | ||
| 9 | 9 | |
| 10 | 10 | namespace Automattic\Jetpack\Extensions\Blogging_Prompt; |
| 11 | 11 | |
| 12 | 12 | use Automattic\Jetpack\Blocks; |
| 13 | -use Jetpack_Gutenberg; | |
| 14 | 13 | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit( 0 ); | |
| 16 | +} | |
| 17 | + | |
| 15 | 18 | /** |
| 16 | 19 | * Registers the block for use in Gutenberg |
| 17 | 20 | * This is done via an action so that we can disable |
| 18 | 21 | * registration if we need to. |
| @@ -29,8 +32,11 @@ | ||
| 29 | 32 | |
| 30 | 33 | /** |
| 31 | 34 | * Blogging Prompt block registration/dependency declaration. |
| 32 | 35 | * |
| 36 | + * The render implementation lives in render.php and is only loaded when the | |
| 37 | + * block is actually rendered, keeping it out of the eager front-end path. | |
| 38 | + * | |
| 33 | 39 | * @param array $attr Array containing the Blogging Prompt block attributes. |
| 34 | 40 | * @param string $content String containing the Blogging Prompt block content. |
| 35 | 41 | * |
| 36 | 42 | * @return string |
| @@ -35,11 +41,7 @@ | ||
| 35 | 41 | * |
| 36 | 42 | * @return string |
| 37 | 43 | */ |
| 38 | 44 | function load_assets( $attr, $content ) { |
| 39 | - /* | |
| 40 | - * Enqueue necessary scripts and styles. | |
| 41 | - */ | |
| 42 | - Jetpack_Gutenberg::load_assets_as_required( __DIR__ ); | |
| 43 | - | |
| 44 | - return $content; | |
| 45 | + require_once __DIR__ . '/render.php'; | |
| 46 | + return render_implementation( $attr, $content ); | |
| 45 | 47 | } |