Returns the default slugs for all the presets in an associative array whose keys are the preset paths and the leafs is the list of slugs.
Description
For example:
array(
'color' => array(
'palette' => array( 'slug-1', 'slug-2' ),
'gradients' => array( 'slug-3', 'slug-4' ),
),
)
Parameters
$data
arrayrequired- A theme.json like structure.
$node_path
arrayrequired- The path to inspect. It’s
'settings'
by default.
Source
$nodes[] = array(
'path' => $node_path,
);
continue;
}
$nodes[] = array(
'path' => $node_path,
'selector' => $selectors[ $name ]['elements'][ $element ],
);
// Handle any pseudo selectors for the element.
if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element ] ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element ] as $pseudo_selector ) {
if ( isset( $theme_json['styles']['blocks'][ $name ]['elements'][ $element ][ $pseudo_selector ] ) ) {
$node_path = array( 'styles', 'blocks', $name, 'elements', $element );
if ( $include_node_paths_only ) {
$nodes[] = array(
'path' => $node_path,
);
continue;
}
$nodes[] = array(
'path' => $node_path,
'selector' => static::append_to_selector( $selectors[ $name ]['elements'][ $element ], $pseudo_selector ),
);
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.