Skip to content

Commit

Permalink
Prefix block style variations option with clarifying verb
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Jun 17, 2024
1 parent a3be836 commit aacb543
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ public function get_settings() {
* - 'scope' that makes sure all style are scoped to a given selector
* - `root_selector` which overwrites and forces a given selector to be used on the root node
* - `skip_root_layout_styles` which omits root layout styles from the generated stylesheet.
* - `block_style_variations` which includes CSS for block style variations.
* - `include_block_style_variations` which includes CSS for block style variations.
* @return string The resulting stylesheet.
*/
public function get_stylesheet( $types = array( 'variables', 'styles', 'presets' ), $origins = null, $options = array() ) {
Expand Down Expand Up @@ -2490,7 +2490,7 @@ protected static function get_setting_nodes( $theme_json, $selectors = array() )
* @param array $selectors List of selectors per block.
* @param array $options An array of options to facilitate filtering style node generation
* The options currently supported are:
* - `block_style_variations` which includes CSS for block style variations.
* - `include_block_style_variations` which includes CSS for block style variations.
* @return array An array of style nodes metadata.
*/
protected static function get_style_nodes( $theme_json, $selectors = array(), $options = array() ) {
Expand Down Expand Up @@ -2614,7 +2614,7 @@ private static function update_separator_declarations( $declarations ) {
* @param array $selectors Optional list of selectors per block.
* @param array $options An array of options to facilitate filtering node generation
* The options currently supported are:
* - `block_style_variations` which includes CSS for block style variations.
* - `include_block_style_variations` which includes CSS for block style variations.
* @return array The block nodes in theme.json.
*/
private static function get_block_nodes( $theme_json, $selectors = array(), $options = array() ) {
Expand Down Expand Up @@ -2646,7 +2646,7 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt
}

$variation_selectors = array();
$include_variations = $options['block_style_variations'] ?? false;
$include_variations = $options['include_block_style_variations'] ?? false;
if ( $include_variations && isset( $node['variations'] ) ) {
foreach ( $node['variations'] as $variation => $node ) {
$variation_selectors[] = array(
Expand Down Expand Up @@ -3331,7 +3331,7 @@ public static function remove_insecure_properties( $theme_json, $origin = 'theme
$theme_json = static::sanitize( $theme_json, $valid_block_names, $valid_element_names, $valid_variations );

$blocks_metadata = static::get_blocks_metadata();
$style_options = array( 'block_style_variations' => true ); // Allow variations data.
$style_options = array( 'include_block_style_variations' => true ); // Allow variations data.
$style_nodes = static::get_style_nodes( $theme_json, $blocks_metadata, $style_options );

foreach ( $style_nodes as $metadata ) {
Expand Down
2 changes: 1 addition & 1 deletion phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5473,7 +5473,7 @@ public function test_opt_in_to_block_style_variations() {
),
);
$selectors = array();
$options = array( 'block_style_variations' => true );
$options = array( 'include_block_style_variations' => true );

$block_nodes = $func->invoke( null, $theme_json, $selectors, $options );
$button_variations = $block_nodes[0]['variations'] ?? array();
Expand Down

0 comments on commit aacb543

Please sign in to comment.