wpseek.com
WordPress开发者和主题制作者的搜索引擎



block_core_gallery_render_context › WordPress Function

Since7.0.0
已弃用n/a
› block_core_gallery_render_context ( $context, $parsed_block )
参数: (2)
  • (array) $context Default context.
    Required: Yes
  • (array) $parsed_block Block being rendered, filtered by render_block_data.
    Required: Yes
返回:
  • (array) Filtered context.
定义在:
文档:

Adds a unique ID to the gallery block context.



源码

function block_core_gallery_render_context( $context, $parsed_block ) {
	if ( 'core/gallery' === $parsed_block['blockName'] ) {
		$context['galleryId'] = uniqid();
	}
	return $context;
}