// Is there metadata for all currently registered blocks?
$blocks =
array_diff_key( $blocks,
static::
$blocks_metadata );
if ( empty( $blocks ) ) { return static::
$blocks_metadata;
} foreach ( $blocks as $block_name =>
$block_type ) { $root_selector =
wp_get_block_css_selector( $block_type );
static::
$blocks_metadata[ $block_name ]['selector'
] =
$root_selector;
static::
$blocks_metadata[ $block_name ]['selectors'
] =
static::
get_block_selectors( $block_type,
$root_selector );
$elements =
static::
get_block_element_selectors( $root_selector );
if ( !
empty( $elements ) ) { static::
$blocks_metadata[ $block_name ]['elements'
] =
$elements;
} // The block may or may not have a duotone selector.
$duotone_selector =
wp_get_block_css_selector( $block_type, 'filter.duotone'
);
// Keep backwards compatibility for support.color.__experimentalDuotone.
if ( null ===
$duotone_selector ) {