Changeset 54383 for trunk/src/wp-includes/blocks/post-featured-image.php
- Timestamp:
- 10/04/2022 03:04:52 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/post-featured-image.php
r54257 r54383 84 84 $has_solid_overlay = isset( $attributes['overlayColor'] ) && $attributes['overlayColor']; 85 85 $has_custom_overlay = isset( $attributes['customOverlayColor'] ) && $attributes['customOverlayColor']; 86 $class_names = array( 87 'wp-block-post-featured-image__overlay', 88 ); 89 $styles_properties = array(); 86 $class_names = array( 'wp-block-post-featured-image__overlay' ); 87 $styles = array(); 90 88 91 89 if ( ! $has_dim_background ) { … … 93 91 } 94 92 95 // Generate required classes for the element. 93 // Apply border classes and styles. 94 $border_attributes = get_block_core_post_featured_image_border_attributes( $attributes ); 95 96 if ( ! empty( $border_attributes['class'] ) ) { 97 $class_names[] = $border_attributes['class']; 98 } 99 100 if ( ! empty( $border_attributes['style'] ) ) { 101 $styles[] = $border_attributes['style']; 102 } 103 104 // Apply overlay and gradient classes. 96 105 if ( $has_dim_background ) { 97 106 $class_names[] = 'has-background-dim'; … … 111 120 } 112 121 113 // Generate required CSS properties and their values. 114 if ( ! empty( $attributes['style']['border']['radius'] ) ) { 115 $styles_properties['border-radius'] = $attributes['style']['border']['radius']; 116 } 117 118 if ( ! empty( $attributes['style']['border']['width'] ) ) { 119 $styles_properties['border-width'] = $attributes['style']['border']['width']; 120 } 121 122 // Apply background styles. 122 123 if ( $has_custom_gradient ) { 123 $styles _properties['background-image'] = $attributes['customGradient'];124 $styles[] = sprintf( 'background-image: %s;', $attributes['customGradient'] ); 124 125 } 125 126 126 127 if ( $has_custom_overlay ) { 127 $styles_properties['background-color'] = $attributes['customOverlayColor']; 128 } 129 130 $styles = ''; 131 132 foreach ( $styles_properties as $style_attribute => $style_attribute_value ) { 133 $styles .= "{$style_attribute}: $style_attribute_value; "; 128 $styles[] = sprintf( 'background-color: %s;', $attributes['customOverlayColor'] ); 134 129 } 135 130 … … 137 132 '<span class="%s" style="%s" aria-hidden="true"></span>', 138 133 esc_attr( implode( ' ', $class_names ) ), 139 esc_attr( trim( $styles) )134 esc_attr( safecss_filter_attr( implode( ' ', $styles ) ) ) 140 135 ); 141 142 136 } 143 137
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)