Changeset 55246 for trunk/src/wp-includes/blocks/calendar.php
- Timestamp:
- 02/07/2023 07:01:56 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/blocks/calendar.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/calendar.php
r54257 r55246 41 41 } 42 42 43 $color_block_styles = array(); 44 45 // Text color. 46 $preset_text_color = array_key_exists( 'textColor', $attributes ) ? "var:preset|color|{$attributes['textColor']}" : null; 47 $custom_text_color = _wp_array_get( $attributes, array( 'style', 'color', 'text' ), null ); 48 $color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color; 49 50 // Background Color. 51 $preset_background_color = array_key_exists( 'backgroundColor', $attributes ) ? "var:preset|color|{$attributes['backgroundColor']}" : null; 52 $custom_background_color = _wp_array_get( $attributes, array( 'style', 'color', 'background' ), null ); 53 $color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color; 54 55 // Generate color styles and classes. 56 $styles = wp_style_engine_get_styles( array( 'color' => $color_block_styles ), array( 'convert_vars_to_classnames' => true ) ); 57 $inline_styles = empty( $styles['css'] ) ? '' : sprintf( ' style="%s"', esc_attr( $styles['css'] ) ); 58 $classnames = empty( $styles['classnames'] ) ? '' : ' ' . esc_attr( $styles['classnames'] ); 59 if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) { 60 $classnames .= ' has-link-color'; 61 } 62 // Apply color classes and styles to the calendar. 63 $calendar = str_replace( '<table', '<table' . $inline_styles, get_calendar( true, false ) ); 64 $calendar = str_replace( 'class="wp-calendar-table', 'class="wp-calendar-table' . $classnames, $calendar ); 65 43 66 $wrapper_attributes = get_block_wrapper_attributes(); 44 67 $output = sprintf( 45 68 '<div %1$s>%2$s</div>', 46 69 $wrapper_attributes, 47 get_calendar( true, false )70 $calendar 48 71 ); 49 72
Note: See TracChangeset
for help on using the changeset viewer.