| 1 |
<?php |
| 2 |
/** |
| 3 |
* Load code specific to Gutenberg blocks which are not tied to a module. |
| 4 |
* This file is unusual, and is not an actual `module` as such. |
| 5 |
* It is included in ./module-extras.php |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
jetpack_register_block( |
| 10 |
'map', |
| 11 |
array( |
| 12 |
'render_callback' => 'jetpack_map_block_load_assets', |
| 13 |
) |
| 14 |
); |
| 15 |
|
| 16 |
/** |
| 17 |
* Map block registration/dependency declaration. |
| 18 |
* |
| 19 |
* @param array $attr - Array containing the map block attributes. |
| 20 |
* @param string $content - String containing the map block content. |
| 21 |
* |
| 22 |
* @return string |
| 23 |
*/ |
| 24 |
function jetpack_map_block_load_assets( $attr, $content ) { |
| 25 |
$dependencies = array( |
| 26 |
'lodash', |
| 27 |
'wp-element', |
| 28 |
'wp-i18n', |
| 29 |
'wp-api-fetch', |
| 30 |
); |
| 31 |
Jetpack_Gutenberg::load_assets_as_required( 'map', $dependencies ); |
| 32 |
return $content; |
| 33 |
} |
| 34 |
|