Changeset 11355
- Timestamp:
- 12/06/2021 04:04:19 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-blocks.php
r10440 r11355 51 51 continue; 52 52 } 53 $block_icon = isset( $block->icon ) ? $block->icon : ''; 53 54 $block_icon = ''; 55 $block_styles = []; 56 if ( isset( $block->icon->src ) ) { 57 $block_icon = $block->icon->src; 58 59 if ( isset( $block->icon->foreground ) ) { 60 $block_styles[] = 'color: ' . sanitize_hex_color( $block->icon->foreground ); 61 } 62 63 if ( isset( $block->icon->background ) ) { 64 $block_styles[] = 'background-color: ' . sanitize_hex_color( $block->icon->background ); 65 } 66 67 } elseif ( isset( $block->icon ) && is_string( $block->icon ) ) { 68 $block_icon = $block->icon; 69 } 70 54 71 $block_classes = 'plugin-blocks-list-item'; 55 72 $block_classes .= isset( $block->description ) ? ' has-description' : ''; 73 $block_style = $block_styles ? 'style="' . implode('; ', $block_styles ) . '"' : ''; 56 74 ?> 57 75 <li class="<?php echo esc_attr( $block_classes ); ?>"> 58 76 <?php if ( false !== strpos( $block_icon, '<svg' ) ) : ?> 59 <span class="block-icon" >77 <span class="block-icon" <?php echo $block_style; ?>> 60 78 <?php echo wp_kses( str_replace( '<svg ', '<svg role="img" aria-hidden="true" focusable="false" ', $block_icon ), $allowed_svg ); ?> 61 79 </span> 62 80 <?php elseif ( $block_icon ) : ?> 63 <span class="block-icon dashicons dashicons-<?php echo esc_attr( $block ->icon ); ?>"></span>81 <span class="block-icon dashicons dashicons-<?php echo esc_attr( $block_icon ); ?>" <?php echo $block_style; ?>></span> 64 82 <?php else : ?> 65 83 <span class="block-icon dashicons dashicons-block-default"></span>
Note: See TracChangeset
for help on using the changeset viewer.