Skip to content

Commit

Permalink
Theme JSON: get_block_nodes - relocate $selectors assignment (#66265)
Browse files Browse the repository at this point in the history
Backport from WordPress/wordpress-develop#7575

Co-authored-by: ramonjd <[email protected]>
Co-authored-by: mukeshpanchal27 <[email protected]>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent b4443e4 commit 0b972a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -2738,10 +2738,14 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt
return $nodes;
}

$selectors = empty( $selectors ) ? static::get_blocks_metadata() : $selectors;
$include_variations = $options['include_block_style_variations'] ?? false;
$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 ) {
Expand Down

0 comments on commit 0b972a8

Please sign in to comment.