latex.php
43 lines
| 1 | <?php |
| 2 | /** |
| 3 | * LaTeX Block. |
| 4 | * |
| 5 | * @since 15.0 |
| 6 | * |
| 7 | * @package automattic/jetpack |
| 8 | */ |
| 9 | |
| 10 | namespace Automattic\Jetpack\Extensions\Latex; |
| 11 | |
| 12 | use Automattic\Jetpack\Blocks; |
| 13 | use Jetpack_Gutenberg; |
| 14 | |
| 15 | /** |
| 16 | * Register the block. |
| 17 | */ |
| 18 | function latex_formula_block_init() { |
| 19 | Blocks::jetpack_register_block( |
| 20 | __DIR__, |
| 21 | array( 'render_callback' => __NAMESPACE__ . '\load_assets' ) |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | add_action( 'init', __NAMESPACE__ . '\latex_formula_block_init' ); |
| 26 | |
| 27 | /** |
| 28 | * Load the assets for the block. |
| 29 | * |
| 30 | * @param array $attr The attributes of the block. |
| 31 | * @param string $content The content of the block. |
| 32 | * |
| 33 | * @return string The content of the block. |
| 34 | */ |
| 35 | function load_assets( $attr, $content ) { |
| 36 | /* |
| 37 | * Enqueue necessary scripts and styles. |
| 38 | */ |
| 39 | Jetpack_Gutenberg::load_assets_as_required( __DIR__ ); |
| 40 | |
| 41 | return $content; |
| 42 | } |
| 43 |