block_core_gallery_render_context()
Adds a unique ID to the gallery block context.
No Hooks.
Returns
Array. Filtered context.
Usage
block_core_gallery_render_context( $context, $parsed_block );
- $context(array) (required)
- Default context.
- $parsed_block(array) (required)
- Block being rendered, filtered by render_block_data.
Changelog
| Since 7.0.0 | Introduced. |
block_core_gallery_render_context() block core gallery render context code WP 7.0
function block_core_gallery_render_context( $context, $parsed_block ) {
if ( 'core/gallery' === $parsed_block['blockName'] ) {
$context['galleryId'] = uniqid();
}
return $context;
}