- Timestamp:
- 03/27/2024 03:58:46 PM (8 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json-resolver.php
r57260 r57885 312 312 } 313 313 $theme_support_data['settings']['color']['defaultGradients'] = $default_gradients; 314 315 if ( ! isset( $theme_support_data['settings']['shadow'] ) ) { 316 $theme_support_data['settings']['shadow'] = array(); 317 } 318 /* 319 * Shadow presets are explicitly disabled for classic themes until a 320 * decision is made for whether the default presets should match the 321 * other presets or if they should be disabled by default in classic 322 * themes. See https://github.com/WordPress/gutenberg/issues/59989. 323 */ 324 $theme_support_data['settings']['shadow']['defaultPresets'] = false; 314 325 315 326 // Allow themes to enable link color setting via theme_support. -
trunk/src/wp-includes/class-wp-theme-json.php
r57751 r57885 659 659 * @since 6.2.0 Added `dimensions.minHeight` and `position.sticky`. 660 660 * @since 6.4.0 Added `background.backgroundImage`. 661 * @since 6.5.0 Added `background.backgroundSize` , `dimensions.aspectRatio`, and `shadow.defaultPresets`.661 * @since 6.5.0 Added `background.backgroundSize` and `dimensions.aspectRatio`. 662 662 * @var array 663 663 */ … … 680 680 array( 'spacing', 'padding' ), 681 681 array( 'typography', 'lineHeight' ), 682 array( 'shadow', 'defaultPresets' ),683 682 ); 684 683 -
trunk/src/wp-includes/theme.json
r57827 r57885 192 192 }, 193 193 "shadow": { 194 "defaultPresets": false,194 "defaultPresets": true, 195 195 "presets": [ 196 196 { -
trunk/tests/phpunit/data/themedir1/block-theme/theme.json
r57662 r57885 49 49 "padding": true, 50 50 "blockGap": true 51 }, 52 "shadow": { 53 "presets": [ 54 { 55 "name": "Natural", 56 "slug": "natural", 57 "shadow": "2px 2px 3px #000" 58 }, 59 { 60 "name": "Test", 61 "slug": "test", 62 "shadow": "2px 2px 3px #000" 63 } 64 ] 51 65 }, 52 66 "blocks": { -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r57717 r57885 294 294 'lineHeight' => true, 295 295 ), 296 'shadow' => array(297 'defaultPresets' => true,298 ),299 296 'blocks' => array( 300 297 'core/paragraph' => array( … … 334 331 'typography' => array( 335 332 'lineHeight' => false, 336 ),337 'shadow' => array(338 'defaultPresets' => true,339 333 ), 340 334 ), -
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r57662 r57885 202 202 'blockGap' => true, 203 203 ), 204 'shadow' => array( 205 'presets' => array( 206 'theme' => array( 207 array( 208 'name' => 'Natural', 209 'slug' => 'natural', 210 'shadow' => '2px 2px 3px #000', 211 ), 212 array( 213 'name' => 'Test', 214 'slug' => 'test', 215 'shadow' => '2px 2px 3px #000', 216 ), 217 ), 218 ), 219 ), 204 220 'blocks' => array( 205 221 'core/paragraph' => array( … … 556 572 'slug' => 'custom', 557 573 'size' => '100px', 574 ), 575 ), 576 ), 577 ), 578 'shadow' => array( 579 'presets' => array( 580 'theme' => array( 581 array( 582 'name' => 'Natural', 583 'slug' => 'natural', 584 'shadow' => '2px 2px 3px #000', 585 ), 586 array( 587 'name' => 'Test', 588 'slug' => 'test', 589 'shadow' => '2px 2px 3px #000', 558 590 ), 559 591 ), … … 1071 1103 ); 1072 1104 } 1105 1106 /** 1107 * @ticket 60815 1108 */ 1109 public function test_theme_shadow_presets_do_not_override_default_shadow_presets() { 1110 switch_theme( 'block-theme' ); 1111 1112 $theme_json_resolver = new WP_Theme_JSON_Resolver(); 1113 $theme_json = $theme_json_resolver->get_merged_data(); 1114 $actual_settings = $theme_json->get_settings()['shadow']['presets']; 1115 1116 $expected_settings = array( 1117 'default' => array( 1118 array( 1119 'name' => 'Natural', 1120 'shadow' => '6px 6px 9px rgba(0, 0, 0, 0.2)', 1121 'slug' => 'natural', 1122 ), 1123 array( 1124 'name' => 'Deep', 1125 'shadow' => '12px 12px 50px rgba(0, 0, 0, 0.4)', 1126 'slug' => 'deep', 1127 ), 1128 array( 1129 'name' => 'Sharp', 1130 'shadow' => '6px 6px 0px rgba(0, 0, 0, 0.2)', 1131 'slug' => 'sharp', 1132 ), 1133 array( 1134 'name' => 'Outlined', 1135 'shadow' => '6px 6px 0px -3px rgba(255, 255, 255, 1), 6px 6px rgba(0, 0, 0, 1)', 1136 'slug' => 'outlined', 1137 ), 1138 array( 1139 'name' => 'Crisp', 1140 'shadow' => '6px 6px 0px rgba(0, 0, 0, 1)', 1141 'slug' => 'crisp', 1142 ), 1143 ), 1144 'theme' => array( 1145 array( 1146 'name' => 'Test', 1147 'shadow' => '2px 2px 3px #000', 1148 'slug' => 'test', 1149 ), 1150 ), 1151 ); 1152 1153 wp_recursive_ksort( $actual_settings ); 1154 wp_recursive_ksort( $expected_settings ); 1155 1156 $this->assertSame( 1157 $expected_settings, 1158 $actual_settings 1159 ); 1160 } 1161 1162 /** 1163 * @ticket 60815 1164 */ 1165 public function test_shadow_default_presets_value_for_block_and_classic_themes() { 1166 $theme_json_resolver = new WP_Theme_JSON_Resolver(); 1167 $theme_json = $theme_json_resolver->get_merged_data(); 1168 1169 $default_presets_for_classic = $theme_json->get_settings()['shadow']['defaultPresets']; 1170 $this->assertFalse( $default_presets_for_classic ); 1171 1172 switch_theme( 'block-theme' ); 1173 $theme_json_resolver = new WP_Theme_JSON_Resolver(); 1174 $theme_json = $theme_json_resolver->get_merged_data(); 1175 1176 $default_presets_for_block = $theme_json->get_settings()['shadow']['defaultPresets']; 1177 $this->assertTrue( $default_presets_for_block ); 1178 } 1073 1179 }
Note: See TracChangeset
for help on using the changeset viewer.