Skip to content

Commit

Permalink
Reinstate processing of variation > block > elements in block node ge…
Browse files Browse the repository at this point in the history
…neration
  • Loading branch information
aaronrobertshaw committed Jan 11, 2024
1 parent c47aa41 commit 9aca87e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,26 @@ private static function get_block_nodes( $theme_json, $selectors = array() ) {
}
}

$variation_block_elements = $variation_block_node['elements'] ?? array();
foreach ( $variation_block_elements as $variation_element => $variation_element_node ) {
$nodes[] = array(
'path' => array( 'styles', 'blocks', $name, 'variations', $variation, 'blocks', $variation_block, 'elements', $variation_element ),
'selector' => static::scope_selector( $variation_block_selector, static::ELEMENTS[ $variation_element ] ),
);

if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $variation_element ] ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $variation_element ] as $pseudo_selector ) {
if ( isset( $variation_element_node[ $pseudo_selector ] ) ) {
$pseudo_element_selector = static::append_to_selector( static::ELEMENTS[ $variation_element ], $pseudo_selector );
$nodes[] = array(
'path' => array( 'styles', 'blocks', $name, 'variations', $variation, 'blocks', $variation_block, 'elements', $variation_element ),
'selector' => static::scope_selector( $variation_block_selector, $pseudo_element_selector ),
);
}
}
}
}

$variation_nodes[] = array(
'name' => $variation_block,
'path' => array( 'styles', 'blocks', $name, 'variations', $variation, 'blocks', $variation_block ),
Expand Down

0 comments on commit 9aca87e

Please sign in to comment.