Changeset 52232 for trunk/src/wp-includes/blocks/navigation.php
- Timestamp:
- 11/23/2021 05:38:45 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/navigation.php
r52161 r52232 3 3 * Server-side rendering of the `core/navigation` block. 4 4 * 5 * @package gutenberg5 * @package WordPress 6 6 */ 7 7 … … 15 15 function block_core_navigation_build_css_colors( $attributes ) { 16 16 $colors = array( 17 'css_classes' => array(), 18 'inline_styles' => '', 17 'css_classes' => array(), 18 'inline_styles' => '', 19 'overlay_css_classes' => array(), 20 'overlay_inline_styles' => '', 19 21 ); 20 22 … … 53 55 // Add the custom background-color inline style. 54 56 $colors['inline_styles'] .= sprintf( 'background-color: %s;', $attributes['customBackgroundColor'] ); 57 } 58 59 // Overlay text color. 60 $has_named_overlay_text_color = array_key_exists( 'overlayTextColor', $attributes ); 61 $has_custom_overlay_text_color = array_key_exists( 'customOverlayTextColor', $attributes ); 62 63 // If has overlay text color. 64 if ( $has_custom_overlay_text_color || $has_named_overlay_text_color ) { 65 // Add has-text-color class. 66 $colors['overlay_css_classes'][] = 'has-text-color'; 67 } 68 69 if ( $has_named_overlay_text_color ) { 70 // Add the overlay color class. 71 $colors['overlay_css_classes'][] = sprintf( 'has-%s-color', $attributes['overlayTextColor'] ); 72 } elseif ( $has_custom_overlay_text_color ) { 73 // Add the custom overlay color inline style. 74 $colors['overlay_inline_styles'] .= sprintf( 'color: %s;', $attributes['customOverlayTextColor'] ); 75 } 76 77 // Overlay background color. 78 $has_named_overlay_background_color = array_key_exists( 'overlayBackgroundColor', $attributes ); 79 $has_custom_overlay_background_color = array_key_exists( 'customOverlayBackgroundColor', $attributes ); 80 81 // If has overlay background color. 82 if ( $has_custom_overlay_background_color || $has_named_overlay_background_color ) { 83 // Add has-background class. 84 $colors['overlay_css_classes'][] = 'has-background'; 85 } 86 87 if ( $has_named_overlay_background_color ) { 88 // Add the overlay background-color class. 89 $colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color', $attributes['overlayBackgroundColor'] ); 90 } elseif ( $has_custom_overlay_background_color ) { 91 // Add the custom overlay background-color inline style. 92 $colors['overlay_inline_styles'] .= sprintf( 'background-color: %s;', $attributes['customOverlayBackgroundColor'] ); 55 93 } 56 94 … … 248 286 'wp-block-navigation__responsive-container', 249 287 $is_hidden_by_default ? 'hidden-by-default' : '', 288 implode( ' ', $colors['overlay_css_classes'] ), 250 289 ); 251 290 $open_button_classes = array( … … 256 295 $responsive_container_markup = sprintf( 257 296 '<button aria-expanded="false" aria-haspopup="true" aria-label="%3$s" class="%6$s" data-micromodal-trigger="modal-%1$s"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg></button> 258 <div class="%5$s" id="modal-%1$s">297 <div class="%5$s" style="%7$s" id="modal-%1$s"> 259 298 <div class="wp-block-navigation__responsive-close" tabindex="-1" data-micromodal-close> 260 299 <div class="wp-block-navigation__responsive-dialog" role="dialog" aria-modal="true" aria-labelledby="modal-%1$s-title" > … … 271 310 __( 'Close menu' ), // Close button label. 272 311 implode( ' ', $responsive_container_classes ), 273 implode( ' ', $open_button_classes ) 312 implode( ' ', $open_button_classes ), 313 $colors['overlay_inline_styles'] 274 314 ); 275 315
Note: See TracChangeset
for help on using the changeset viewer.