Determines whether a presets should be overridden or not.
Parameters
$theme_json
arrayrequired- The theme.json like structure to inspect.
$path
arrayrequired- Path to inspect.
$override
bool|arrayrequired- Data to compute whether to override the preset.
Source
$include_node_paths_only = $options['include_node_paths_only'] ?? false;
// If only node paths are to be returned, skip selector assignment.
if ( ! $include_node_paths_only ) {
$selectors = empty( $selectors ) ? static::get_blocks_metadata() : $selectors;
}
foreach ( $theme_json['styles']['blocks'] as $name => $node ) {
$node_path = array( 'styles', 'blocks', $name );
if ( $include_node_paths_only ) {
$variation_paths = array();
if ( $include_variations && isset( $node['variations'] ) ) {
foreach ( $node['variations'] as $variation => $variation_node ) {
$variation_paths[] = array(
'path' => array( 'styles', 'blocks', $name, 'variations', $variation ),
);
}
}
$node = array(
'path' => $node_path,
);
if ( ! empty( $variation_paths ) ) {
$node['variations'] = $variation_paths;
}
$nodes[] = $node;
} else {
$selector = null;
if ( isset( $selectors[ $name ]['selector'] ) ) {
$selector = $selectors[ $name ]['selector'];
}
$duotone_selector = null;
if ( isset( $selectors[ $name ]['duotone'] ) ) {
$duotone_selector = $selectors[ $name ]['duotone'];
Changelog
Version | Description |
---|---|
6.0.0 | Use 'get_metadata_boolean' instead. |
5.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.