Changeset 50945 for trunk/src/wp-includes/block-supports/typography.php
- Timestamp:
- 05/21/2021 10:12:42 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/typography.php
r50929 r50945 69 69 } 70 70 71 $classes = array(); 72 $styles = array(); 71 $attributes = array(); 72 $classes = array(); 73 $styles = array(); 73 74 74 75 $has_font_family_support = _wp_array_get( $block_type->supports, array( '__experimentalFontFamily' ), false ); … … 82 83 $skip_font_size_support_serialization = _wp_array_get( $block_type->supports, array( '__experimentalSkipFontSizeSerialization' ), false ); 83 84 85 // Covers all typography features _except_ font size. 86 $skip_typography_serialization = _wp_array_get( $block_type->supports, array( '__experimentalSkipTypographySerialization' ), false ); 87 84 88 // Font Size. 85 89 if ( $has_font_size_support && ! $skip_font_size_support_serialization ) { … … 96 100 97 101 // Font Family. 98 if ( $has_font_family_support ) {102 if ( $has_font_family_support && ! $skip_typography_serialization ) { 99 103 $has_font_family = isset( $block_attributes['style']['typography']['fontFamily'] ); 100 104 // Apply required class and style. … … 107 111 $styles[] = sprintf( 'font-family: var(--wp--preset--font-family--%s);', $font_family_name ); 108 112 } else { 109 $styles[] = sprintf( 'font-family: %s;', $block_attributes['style'][' color']['fontFamily'] );113 $styles[] = sprintf( 'font-family: %s;', $block_attributes['style']['typography']['fontFamily'] ); 110 114 } 111 115 } … … 113 117 114 118 // Font style. 115 if ( $has_font_style_support ) {119 if ( $has_font_style_support && ! $skip_typography_serialization ) { 116 120 // Apply font style. 117 121 $font_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontStyle', 'font-style' ); … … 122 126 123 127 // Font weight. 124 if ( $has_font_weight_support ) {128 if ( $has_font_weight_support && ! $skip_typography_serialization ) { 125 129 // Apply font weight. 126 130 $font_weight = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontWeight', 'font-weight' ); … … 131 135 132 136 // Line Height. 133 if ( $has_line_height_support ) {137 if ( $has_line_height_support && ! $skip_typography_serialization ) { 134 138 $has_line_height = isset( $block_attributes['style']['typography']['lineHeight'] ); 135 139 // Add the style (no classes for line-height). … … 140 144 141 145 // Text Decoration. 142 if ( $has_text_decoration_support ) {146 if ( $has_text_decoration_support && ! $skip_typography_serialization ) { 143 147 $text_decoration_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textDecoration', 'text-decoration' ); 144 148 if ( $text_decoration_style ) { … … 148 152 149 153 // Text Transform. 150 if ( $has_text_transform_support ) {154 if ( $has_text_transform_support && ! $skip_typography_serialization ) { 151 155 $text_transform_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textTransform', 'text-transform' ); 152 156 if ( $text_transform_style ) { … … 155 159 } 156 160 157 $attributes = array();158 161 if ( ! empty( $classes ) ) { 159 162 $attributes['class'] = implode( ' ', $classes );
Note: See TracChangeset
for help on using the changeset viewer.