Changeset 56709 for trunk/src/wp-includes/class-wp-theme-json.php
- Timestamp:
- 09/26/2023 01:45:23 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-theme-json.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r56643 r56709 924 924 // Keep backwards compatibility for support.color.__experimentalDuotone. 925 925 if ( null === $duotone_selector ) { 926 $duotone_support = _wp_array_get( $block_type->supports, array( 'color', '__experimentalDuotone' ), null ); 926 $duotone_support = isset( $block_type->supports['color']['__experimentalDuotone'] ) 927 ? $block_type->supports['color']['__experimentalDuotone'] 928 : null; 927 929 928 930 if ( $duotone_support ) { … … 1161 1163 public function get_custom_css() { 1162 1164 // Add the global styles root CSS. 1163 $stylesheet = _wp_array_get( $this->theme_json, array( 'styles', 'css' ), '' );1165 $stylesheet = isset( $this->theme_json['styles']['css'] ) ? $this->theme_json['styles']['css'] : ''; 1164 1166 1165 1167 // Add the global styles block CSS. 1166 1168 if ( isset( $this->theme_json['styles']['blocks'] ) ) { 1167 1169 foreach ( $this->theme_json['styles']['blocks'] as $name => $node ) { 1168 $custom_block_css = _wp_array_get( $this->theme_json, array( 'styles', 'blocks', $name, 'css' ) ); 1170 $custom_block_css = isset( $this->theme_json['styles']['blocks'][ $name ]['css'] ) 1171 ? $this->theme_json['styles']['blocks'][ $name ]['css'] 1172 : null; 1169 1173 if ( $custom_block_css ) { 1170 1174 $selector = static::$blocks_metadata[ $name ]['selector']; … … 1285 1289 1286 1290 $selector = isset( $block_metadata['selector'] ) ? $block_metadata['selector'] : ''; 1287 $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null;1291 $has_block_gap_support = isset( $this->theme_json['settings']['spacing']['blockGap'] ); 1288 1292 $has_fallback_gap_support = ! $has_block_gap_support; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback gap styles support. 1289 1293 $node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() ); … … 1301 1305 $block_gap_value = static::ROOT_BLOCK_SELECTOR === $selector ? '0.5em' : null; 1302 1306 if ( ! empty( $block_type ) ) { 1303 $block_gap_value = _wp_array_get( $block_type->supports, array( 'spacing', 'blockGap', '__experimentalDefault' ), null ); 1307 $block_gap_value = isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] ) 1308 ? $block_type->supports['spacing']['blockGap']['__experimentalDefault'] 1309 : null; 1304 1310 } 1305 1311 } else { … … 1327 1333 } 1328 1334 1329 $class_name = _wp_array_get( $layout_definition, array( 'className' ), false );1330 $spacing_rules = _wp_array_get( $layout_definition, array( 'spacingStyles' ), array());1335 $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false; 1336 $spacing_rules = isset( $layout_definition['spacingStyles'] ) ? $layout_definition['spacingStyles'] : array(); 1331 1337 1332 1338 if ( … … 1384 1390 $valid_display_modes = array( 'block', 'flex', 'grid' ); 1385 1391 foreach ( $layout_definitions as $layout_definition ) { 1386 $class_name = _wp_array_get( $layout_definition, array( 'className' ), false );1387 $base_style_rules = _wp_array_get( $layout_definition, array( 'baseStyles' ), array());1392 $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false; 1393 $base_style_rules = isset( $layout_definition['baseStyles'] ) ? $layout_definition['baseStyles'] : array(); 1388 1394 1389 1395 if ( … … 1813 1819 protected static function compute_theme_vars( $settings ) { 1814 1820 $declarations = array(); 1815 $custom_values = _wp_array_get( $settings, array( 'custom' ), array());1821 $custom_values = isset( $settings['custom'] ) ? $settings['custom'] : array(); 1816 1822 $css_vars = static::flatten_tree( $custom_values ); 1817 1823 foreach ( $css_vars as $key => $value ) { … … 2327 2333 $use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments']; 2328 2334 $selector = $block_metadata['selector']; 2329 $settings = _wp_array_get( $this->theme_json, array( 'settings' ));2335 $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array(); 2330 2336 $feature_declarations = static::get_feature_declarations_for_node( $block_metadata, $node ); 2331 2337 … … 2467 2473 public function get_root_layout_rules( $selector, $block_metadata ) { 2468 2474 $css = ''; 2469 $settings = _wp_array_get( $this->theme_json, array( 'settings' ));2475 $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array(); 2470 2476 $use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments']; 2471 2477 … … 2516 2522 $css .= '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'; 2517 2523 2518 $block_gap_value = _wp_array_get( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ), '0.5em' );2519 $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null;2524 $block_gap_value = isset( $this->theme_json['styles']['spacing']['blockGap'] ) ? $this->theme_json['styles']['spacing']['blockGap'] : '0.5em'; 2525 $has_block_gap_support = isset( $this->theme_json['settings']['spacing']['blockGap'] ); 2520 2526 if ( $has_block_gap_support ) { 2521 2527 $block_gap_value = static::get_property_value( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ) ); … … 3356 3362 */ 3357 3363 public function set_spacing_sizes() { 3358 $spacing_scale = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'spacingScale' ), array() ); 3364 $spacing_scale = isset( $this->theme_json['settings']['spacing']['spacingScale'] ) 3365 ? $this->theme_json['settings']['spacing']['spacingScale'] 3366 : array(); 3359 3367 3360 3368 if ( ! isset( $spacing_scale['steps'] ) … … 3595 3603 } 3596 3604 3597 $settings = _wp_array_get( $this->theme_json, array( 'settings' ) ); 3605 $settings = isset( $this->theme_json['settings'] ) 3606 ? $this->theme_json['settings'] 3607 : array(); 3598 3608 3599 3609 foreach ( $metadata['selectors'] as $feature => $feature_selectors ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)