| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Integrations\Blocks; |
| 4 |
|
| 5 |
use WPSEO_Admin_Asset_Manager; |
| 6 |
use Yoast\WP\SEO\Conditionals\Admin\Post_Conditional; |
| 7 |
use Yoast\WP\SEO\Integrations\Integration_Interface; |
| 8 |
|
| 9 |
/** |
| 10 |
* Block_Editor_Integration class to enqueue the block editor assets also for the iframe. |
| 11 |
*/ |
| 12 |
class Block_Editor_Integration implements Integration_Interface { |
| 13 |
|
| 14 |
/** |
| 15 |
* Represents the admin asset manager. |
| 16 |
* |
| 17 |
* @var WPSEO_Admin_Asset_Manager |
| 18 |
*/ |
| 19 |
protected $asset_manager; |
| 20 |
|
| 21 |
/** |
| 22 |
* {@inheritDoc} |
| 23 |
* |
| 24 |
* @return array<Post_Conditional> |
| 25 |
*/ |
| 26 |
public static function get_conditionals() { |
| 27 |
return [ Post_Conditional::class ]; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Constructor. |
| 32 |
* |
| 33 |
* @param WPSEO_Admin_Asset_Manager $asset_manager The asset manager. |
| 34 |
*/ |
| 35 |
public function __construct( WPSEO_Admin_Asset_Manager $asset_manager ) { |
| 36 |
$this->asset_manager = $asset_manager; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Initializes the integration. |
| 41 |
* |
| 42 |
* This is the place to register hooks and filters. |
| 43 |
* |
| 44 |
* @return void |
| 45 |
*/ |
| 46 |
public function register_hooks() { |
| 47 |
\add_action( 'enqueue_block_assets', [ $this, 'enqueue' ] ); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Enqueues the assets for the block editor. |
| 52 |
* |
| 53 |
* @return void |
| 54 |
*/ |
| 55 |
public function enqueue() { |
| 56 |
$this->asset_manager->enqueue_style( 'block-editor' ); |
| 57 |
} |
| 58 |
} |
| 59 |
|