Changeset 58413
- Timestamp:
- 06/14/2024 09:03:40 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/block-style-variations.php
r58394 r58413 250 250 * need to have their name set to the kebab case version of their title. 251 251 */ 252 $variation_name = $have_named_variations ? $key : _wp_to_kebab_case( $variation['title']);252 $variation_name = $have_named_variations ? $key : ( $variation['slug'] ?? _wp_to_kebab_case( $variation['title'] ) ); 253 253 254 254 foreach ( $supported_blocks as $block_type ) { … … 442 442 * need to have their name set to the kebab case version of their title. 443 443 */ 444 $variation_name = $have_named_variations ? $key : _wp_to_kebab_case( $variation['title']);444 $variation_name = $have_named_variations ? $key : ( $variation['slug'] ?? _wp_to_kebab_case( $variation['title'] ) ); 445 445 $variation_label = $variation['title'] ?? $variation_name; 446 446 -
trunk/src/wp-includes/class-wp-theme-json.php
r58409 r58413 359 359 'patterns', 360 360 'settings', 361 'slug', 361 362 'styles', 362 363 'templateParts', … … 3245 3246 * @since 6.6.0 Updated to allow variation element styles and $origin parameter. 3246 3247 * 3247 * @param array $theme_json Structure to sanitize.3248 * @param array $theme_json Structure to sanitize. 3248 3249 * @param string $origin Optional. What source of data this object represents. 3249 3250 * One of 'blocks', 'default', 'theme', or 'custom'. Default 'theme'. -
trunk/tests/phpunit/tests/block-supports/block-style-variations.php
r58394 r58413 62 62 * 63 63 * @ticket 61312 64 * @ticket 61440 64 65 */ 65 66 public function test_add_registered_block_styles_to_theme_data() { … … 99 100 ); 100 101 102 /* 103 * This style is to be deliberately overwritten by the theme.json partial 104 * See `tests/phpunit/data/themedir1/block-theme/styles/block-style-variation-with-slug.json`. 105 */ 106 register_block_style( 107 'core/group', 108 array( 109 'name' => 'WithSlug', 110 'style_data' => array( 111 'color' => array( 112 'background' => 'whitesmoke', 113 'text' => 'black', 114 ), 115 ), 116 ) 117 ); 101 118 register_block_style( 102 119 'core/group', … … 111 128 $expected = array( 112 129 'variations' => array( 130 // @ticket 61440 131 'WithSlug' => array( 132 'color' => array( 133 'background' => 'aliceblue', 134 'text' => 'midnightblue', 135 ), 136 ), 113 137 'my-variation' => $variation_styles_data, 114 138 … … 134 158 135 159 unregister_block_style( 'core/group', 'my-variation' ); 160 unregister_block_style( 'core/group', 'WithSlug' ); 136 161 137 $this->assertSameSetsWithIndex( $ group_styles, $expected);162 $this->assertSameSetsWithIndex( $expected, $group_styles ); 138 163 } 139 164 } -
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r58264 r58413 1161 1161 ), 1162 1162 ), 1163 // @ticket 61440 1164 array( 1165 'blockTypes' => array( 'core/group', 'core/columns' ), 1166 'version' => 3, 1167 'slug' => 'WithSlug', 1168 'title' => 'With Slug', 1169 'styles' => array( 1170 'color' => array( 1171 'background' => 'aliceblue', 1172 'text' => 'midnightblue', 1173 ), 1174 ), 1175 ), 1163 1176 ), 1164 1177 ),
Note: See TracChangeset
for help on using the changeset viewer.