[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Typography block support flag. 4 * 5 * @package WordPress 6 * @since 5.6.0 7 */ 8 9 /** 10 * Registers the style and typography block attributes for block types that support it. 11 * 12 * @since 5.6.0 13 * @access private 14 * 15 * @param WP_Block_Type $block_type Block Type. 16 */ 17 function wp_register_typography_support( $block_type ) { 18 if ( ! property_exists( $block_type, 'supports' ) ) { 19 return; 20 } 21 22 $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false ); 23 if ( ! $typography_supports ) { 24 return; 25 } 26 27 $has_font_family_support = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false ); 28 $has_font_size_support = _wp_array_get( $typography_supports, array( 'fontSize' ), false ); 29 $has_font_style_support = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false ); 30 $has_font_weight_support = _wp_array_get( $typography_supports, array( '__experimentalFontWeight' ), false ); 31 $has_letter_spacing_support = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false ); 32 $has_line_height_support = _wp_array_get( $typography_supports, array( 'lineHeight' ), false ); 33 $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false ); 34 $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false ); 35 36 $has_typography_support = $has_font_family_support 37 || $has_font_size_support 38 || $has_font_style_support 39 || $has_font_weight_support 40 || $has_letter_spacing_support 41 || $has_line_height_support 42 || $has_text_decoration_support 43 || $has_text_transform_support; 44 45 if ( ! $block_type->attributes ) { 46 $block_type->attributes = array(); 47 } 48 49 if ( $has_typography_support && ! array_key_exists( 'style', $block_type->attributes ) ) { 50 $block_type->attributes['style'] = array( 51 'type' => 'object', 52 ); 53 } 54 55 if ( $has_font_size_support && ! array_key_exists( 'fontSize', $block_type->attributes ) ) { 56 $block_type->attributes['fontSize'] = array( 57 'type' => 'string', 58 ); 59 } 60 61 if ( $has_font_family_support && ! array_key_exists( 'fontFamily', $block_type->attributes ) ) { 62 $block_type->attributes['fontFamily'] = array( 63 'type' => 'string', 64 ); 65 } 66 } 67 68 /** 69 * Adds CSS classes and inline styles for typography features such as font sizes 70 * to the incoming attributes array. This will be applied to the block markup in 71 * the front-end. 72 * 73 * @since 5.6.0 74 * @since 6.1.0 Used the style engine to generate CSS and classnames. 75 * @access private 76 * 77 * @param WP_Block_Type $block_type Block type. 78 * @param array $block_attributes Block attributes. 79 * @return array Typography CSS classes and inline styles. 80 */ 81 function wp_apply_typography_support( $block_type, $block_attributes ) { 82 if ( ! property_exists( $block_type, 'supports' ) ) { 83 return array(); 84 } 85 86 $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false ); 87 if ( ! $typography_supports ) { 88 return array(); 89 } 90 91 if ( wp_should_skip_block_supports_serialization( $block_type, 'typography' ) ) { 92 return array(); 93 } 94 95 $has_font_family_support = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false ); 96 $has_font_size_support = _wp_array_get( $typography_supports, array( 'fontSize' ), false ); 97 $has_font_style_support = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false ); 98 $has_font_weight_support = _wp_array_get( $typography_supports, array( '__experimentalFontWeight' ), false ); 99 $has_letter_spacing_support = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false ); 100 $has_line_height_support = _wp_array_get( $typography_supports, array( 'lineHeight' ), false ); 101 $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false ); 102 $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false ); 103 104 // Whether to skip individual block support features. 105 $should_skip_font_size = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontSize' ); 106 $should_skip_font_family = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontFamily' ); 107 $should_skip_font_style = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontStyle' ); 108 $should_skip_font_weight = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontWeight' ); 109 $should_skip_line_height = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'lineHeight' ); 110 $should_skip_text_decoration = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textDecoration' ); 111 $should_skip_text_transform = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' ); 112 $should_skip_letter_spacing = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'letterSpacing' ); 113 114 $typography_block_styles = array(); 115 if ( $has_font_size_support && ! $should_skip_font_size ) { 116 $preset_font_size = array_key_exists( 'fontSize', $block_attributes ) 117 ? "var:preset|font-size|{$block_attributes['fontSize']}" 118 : null; 119 $custom_font_size = isset( $block_attributes['style']['typography']['fontSize'] ) 120 ? $block_attributes['style']['typography']['fontSize'] 121 : null; 122 $typography_block_styles['fontSize'] = $preset_font_size ? $preset_font_size : wp_get_typography_font_size_value( 123 array( 124 'size' => $custom_font_size, 125 ) 126 ); 127 } 128 129 if ( $has_font_family_support && ! $should_skip_font_family ) { 130 $preset_font_family = array_key_exists( 'fontFamily', $block_attributes ) 131 ? "var:preset|font-family|{$block_attributes['fontFamily']}" 132 : null; 133 $custom_font_family = isset( $block_attributes['style']['typography']['fontFamily'] ) 134 ? wp_typography_get_preset_inline_style_value( $block_attributes['style']['typography']['fontFamily'], 'font-family' ) 135 : null; 136 $typography_block_styles['fontFamily'] = $preset_font_family ? $preset_font_family : $custom_font_family; 137 } 138 139 if ( 140 $has_font_style_support && 141 ! $should_skip_font_style && 142 isset( $block_attributes['style']['typography']['fontStyle'] ) 143 ) { 144 $typography_block_styles['fontStyle'] = wp_typography_get_preset_inline_style_value( 145 $block_attributes['style']['typography']['fontStyle'], 146 'font-style' 147 ); 148 } 149 150 if ( 151 $has_font_weight_support && 152 ! $should_skip_font_weight && 153 isset( $block_attributes['style']['typography']['fontWeight'] ) 154 ) { 155 $typography_block_styles['fontWeight'] = wp_typography_get_preset_inline_style_value( 156 $block_attributes['style']['typography']['fontWeight'], 157 'font-weight' 158 ); 159 } 160 161 if ( $has_line_height_support && ! $should_skip_line_height ) { 162 $typography_block_styles['lineHeight'] = _wp_array_get( $block_attributes, array( 'style', 'typography', 'lineHeight' ) ); 163 } 164 165 if ( 166 $has_text_decoration_support && 167 ! $should_skip_text_decoration && 168 isset( $block_attributes['style']['typography']['textDecoration'] ) 169 ) { 170 $typography_block_styles['textDecoration'] = wp_typography_get_preset_inline_style_value( 171 $block_attributes['style']['typography']['textDecoration'], 172 'text-decoration' 173 ); 174 } 175 176 if ( 177 $has_text_transform_support && 178 ! $should_skip_text_transform && 179 isset( $block_attributes['style']['typography']['textTransform'] ) 180 ) { 181 $typography_block_styles['textTransform'] = wp_typography_get_preset_inline_style_value( 182 $block_attributes['style']['typography']['textTransform'], 183 'text-transform' 184 ); 185 } 186 187 if ( 188 $has_letter_spacing_support && 189 ! $should_skip_letter_spacing && 190 isset( $block_attributes['style']['typography']['letterSpacing'] ) 191 ) { 192 $typography_block_styles['letterSpacing'] = wp_typography_get_preset_inline_style_value( 193 $block_attributes['style']['typography']['letterSpacing'], 194 'letter-spacing' 195 ); 196 } 197 198 $attributes = array(); 199 $styles = wp_style_engine_get_styles( 200 array( 'typography' => $typography_block_styles ), 201 array( 'convert_vars_to_classnames' => true ) 202 ); 203 204 if ( ! empty( $styles['classnames'] ) ) { 205 $attributes['class'] = $styles['classnames']; 206 } 207 208 if ( ! empty( $styles['css'] ) ) { 209 $attributes['style'] = $styles['css']; 210 } 211 212 return $attributes; 213 } 214 215 /** 216 * Generates an inline style value for a typography feature e.g. text decoration, 217 * text transform, and font style. 218 * 219 * Note: This function is for backwards compatibility. 220 * * It is necessary to parse older blocks whose typography styles contain presets. 221 * * It mostly replaces the deprecated `wp_typography_get_css_variable_inline_style()`, 222 * but skips compiling a CSS declaration as the style engine takes over this role. 223 * @link https://github.com/wordpress/gutenberg/pull/27555 224 * 225 * @since 6.1.0 226 * 227 * @param string $style_value A raw style value for a single typography feature from a block's style attribute. 228 * @param string $css_property Slug for the CSS property the inline style sets. 229 * @return string A CSS inline style value. 230 */ 231 function wp_typography_get_preset_inline_style_value( $style_value, $css_property ) { 232 // If the style value is not a preset CSS variable go no further. 233 if ( empty( $style_value ) || ! str_contains( $style_value, "var:preset|{$css_property}|" ) ) { 234 return $style_value; 235 } 236 237 /* 238 * For backwards compatibility. 239 * Presets were removed in WordPress/gutenberg#27555. 240 * A preset CSS variable is the style. 241 * Gets the style value from the string and return CSS style. 242 */ 243 $index_to_splice = strrpos( $style_value, '|' ) + 1; 244 $slug = _wp_to_kebab_case( substr( $style_value, $index_to_splice ) ); 245 246 // Return the actual CSS inline style value, 247 // e.g. `var(--wp--preset--text-decoration--underline);`. 248 return sprintf( 'var(--wp--preset--%s--%s);', $css_property, $slug ); 249 } 250 251 /** 252 * Renders typography styles/content to the block wrapper. 253 * 254 * @since 6.1.0 255 * 256 * @param string $block_content Rendered block content. 257 * @param array $block Block object. 258 * @return string Filtered block content. 259 */ 260 function wp_render_typography_support( $block_content, $block ) { 261 if ( ! isset( $block['attrs']['style']['typography']['fontSize'] ) ) { 262 return $block_content; 263 } 264 265 $custom_font_size = $block['attrs']['style']['typography']['fontSize']; 266 $fluid_font_size = wp_get_typography_font_size_value( array( 'size' => $custom_font_size ) ); 267 268 /* 269 * Checks that $fluid_font_size does not match $custom_font_size, 270 * which means it's been mutated by the fluid font size functions. 271 */ 272 if ( ! empty( $fluid_font_size ) && $fluid_font_size !== $custom_font_size ) { 273 // Replaces the first instance of `font-size:$custom_font_size` with `font-size:$fluid_font_size`. 274 return preg_replace( '/font-size\s*:\s*' . preg_quote( $custom_font_size, '/' ) . '\s*;?/', 'font-size:' . esc_attr( $fluid_font_size ) . ';', $block_content, 1 ); 275 } 276 277 return $block_content; 278 } 279 280 /** 281 * Checks a string for a unit and value and returns an array 282 * consisting of `'value'` and `'unit'`, e.g. array( '42', 'rem' ). 283 * 284 * @since 6.1.0 285 * 286 * @param string|int|float $raw_value Raw size value from theme.json. 287 * @param array $options { 288 * Optional. An associative array of options. Default is empty array. 289 * 290 * @type string $coerce_to Coerce the value to rem or px. Default `'rem'`. 291 * @type int $root_size_value Value of root font size for rem|em <-> px conversion. Default `16`. 292 * @type string[] $acceptable_units An array of font size units. Default `array( 'rem', 'px', 'em' )`; 293 * } 294 * @return array|null An array consisting of `'value'` and `'unit'` properties on success. 295 * `null` on failure. 296 */ 297 function wp_get_typography_value_and_unit( $raw_value, $options = array() ) { 298 if ( ! is_string( $raw_value ) && ! is_int( $raw_value ) && ! is_float( $raw_value ) ) { 299 _doing_it_wrong( 300 __FUNCTION__, 301 __( 'Raw size value must be a string, integer, or float.' ), 302 '6.1.0' 303 ); 304 return null; 305 } 306 307 if ( empty( $raw_value ) ) { 308 return null; 309 } 310 311 // Converts numbers to pixel values by default. 312 if ( is_numeric( $raw_value ) ) { 313 $raw_value = $raw_value . 'px'; 314 } 315 316 $defaults = array( 317 'coerce_to' => '', 318 'root_size_value' => 16, 319 'acceptable_units' => array( 'rem', 'px', 'em' ), 320 ); 321 322 $options = wp_parse_args( $options, $defaults ); 323 324 $acceptable_units_group = implode( '|', $options['acceptable_units'] ); 325 $pattern = '/^(\d*\.?\d+)(' . $acceptable_units_group . '){1,1}$/'; 326 327 preg_match( $pattern, $raw_value, $matches ); 328 329 // Bails out if not a number value and a px or rem unit. 330 if ( ! isset( $matches[1] ) || ! isset( $matches[2] ) ) { 331 return null; 332 } 333 334 $value = $matches[1]; 335 $unit = $matches[2]; 336 337 /* 338 * Default browser font size. Later, possibly could inject some JS to 339 * compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. 340 */ 341 if ( 'px' === $options['coerce_to'] && ( 'em' === $unit || 'rem' === $unit ) ) { 342 $value = $value * $options['root_size_value']; 343 $unit = $options['coerce_to']; 344 } 345 346 if ( 'px' === $unit && ( 'em' === $options['coerce_to'] || 'rem' === $options['coerce_to'] ) ) { 347 $value = $value / $options['root_size_value']; 348 $unit = $options['coerce_to']; 349 } 350 351 /* 352 * No calculation is required if swapping between em and rem yet, 353 * since we assume a root size value. Later we might like to differentiate between 354 * :root font size (rem) and parent element font size (em) relativity. 355 */ 356 if ( ( 'em' === $options['coerce_to'] || 'rem' === $options['coerce_to'] ) && ( 'em' === $unit || 'rem' === $unit ) ) { 357 $unit = $options['coerce_to']; 358 } 359 360 return array( 361 'value' => round( $value, 3 ), 362 'unit' => $unit, 363 ); 364 } 365 366 /** 367 * Internal implementation of CSS clamp() based on available min/max viewport 368 * width and min/max font sizes. 369 * 370 * @since 6.1.0 371 * @access private 372 * 373 * @param array $args { 374 * Optional. An associative array of values to calculate a fluid formula 375 * for font size. Default is empty array. 376 * 377 * @type string $maximum_viewport_width Maximum size up to which type will have fluidity. 378 * @type string $minimum_viewport_width Minimum viewport size from which type will have fluidity. 379 * @type string $maximum_font_size Maximum font size for any clamp() calculation. 380 * @type string $minimum_font_size Minimum font size for any clamp() calculation. 381 * @type int $scale_factor A scale factor to determine how fast a font scales within boundaries. 382 * } 383 * @return string|null A font-size value using clamp() on success, otherwise null. 384 */ 385 function wp_get_computed_fluid_typography_value( $args = array() ) { 386 $maximum_viewport_width_raw = isset( $args['maximum_viewport_width'] ) ? $args['maximum_viewport_width'] : null; 387 $minimum_viewport_width_raw = isset( $args['minimum_viewport_width'] ) ? $args['minimum_viewport_width'] : null; 388 $maximum_font_size_raw = isset( $args['maximum_font_size'] ) ? $args['maximum_font_size'] : null; 389 $minimum_font_size_raw = isset( $args['minimum_font_size'] ) ? $args['minimum_font_size'] : null; 390 $scale_factor = isset( $args['scale_factor'] ) ? $args['scale_factor'] : null; 391 392 // Normalizes the minimum font size in order to use the value for calculations. 393 $minimum_font_size = wp_get_typography_value_and_unit( $minimum_font_size_raw ); 394 395 /* 396 * We get a 'preferred' unit to keep units consistent when calculating, 397 * otherwise the result will not be accurate. 398 */ 399 $font_size_unit = isset( $minimum_font_size['unit'] ) ? $minimum_font_size['unit'] : 'rem'; 400 401 // Normalizes the maximum font size in order to use the value for calculations. 402 $maximum_font_size = wp_get_typography_value_and_unit( 403 $maximum_font_size_raw, 404 array( 405 'coerce_to' => $font_size_unit, 406 ) 407 ); 408 409 // Checks for mandatory min and max sizes, and protects against unsupported units. 410 if ( ! $maximum_font_size || ! $minimum_font_size ) { 411 return null; 412 } 413 414 // Uses rem for accessible fluid target font scaling. 415 $minimum_font_size_rem = wp_get_typography_value_and_unit( 416 $minimum_font_size_raw, 417 array( 418 'coerce_to' => 'rem', 419 ) 420 ); 421 422 // Viewport widths defined for fluid typography. Normalize units. 423 $maximum_viewport_width = wp_get_typography_value_and_unit( 424 $maximum_viewport_width_raw, 425 array( 426 'coerce_to' => $font_size_unit, 427 ) 428 ); 429 $minimum_viewport_width = wp_get_typography_value_and_unit( 430 $minimum_viewport_width_raw, 431 array( 432 'coerce_to' => $font_size_unit, 433 ) 434 ); 435 436 /* 437 * Build CSS rule. 438 * Borrowed from https://websemantics.uk/tools/responsive-font-calculator/. 439 */ 440 $view_port_width_offset = round( $minimum_viewport_width['value'] / 100, 3 ) . $font_size_unit; 441 $linear_factor = 100 * ( ( $maximum_font_size['value'] - $minimum_font_size['value'] ) / ( $maximum_viewport_width['value'] - $minimum_viewport_width['value'] ) ); 442 $linear_factor_scaled = round( $linear_factor * $scale_factor, 3 ); 443 $linear_factor_scaled = empty( $linear_factor_scaled ) ? 1 : $linear_factor_scaled; 444 $fluid_target_font_size = implode( '', $minimum_font_size_rem ) . " + ((1vw - $view_port_width_offset) * $linear_factor_scaled)"; 445 446 return "clamp($minimum_font_size_raw, $fluid_target_font_size, $maximum_font_size_raw)"; 447 } 448 449 /** 450 * Returns a font-size value based on a given font-size preset. 451 * Takes into account fluid typography parameters and attempts to return a CSS 452 * formula depending on available, valid values. 453 * 454 * @since 6.1.0 455 * @since 6.1.1 Adjusted rules for min and max font sizes. 456 * @since 6.2.0 Added 'settings.typography.fluid.minFontSize' support. 457 * 458 * @param array $preset { 459 * Required. fontSizes preset value as seen in theme.json. 460 * 461 * @type string $name Name of the font size preset. 462 * @type string $slug Kebab-case, unique identifier for the font size preset. 463 * @type string|int|float $size CSS font-size value, including units if applicable. 464 * } 465 * @param bool $should_use_fluid_typography An override to switch fluid typography "on". Can be used for unit testing. 466 * Default is false. 467 * @return string|null Font-size value or null if a size is not passed in $preset. 468 */ 469 function wp_get_typography_font_size_value( $preset, $should_use_fluid_typography = false ) { 470 if ( ! isset( $preset['size'] ) ) { 471 return null; 472 } 473 474 /* 475 * Catches empty values and 0/'0'. 476 * Fluid calculations cannot be performed on 0. 477 */ 478 if ( empty( $preset['size'] ) ) { 479 return $preset['size']; 480 } 481 482 // Checks if fluid font sizes are activated. 483 $typography_settings = wp_get_global_settings( array( 'typography' ) ); 484 if ( 485 isset( $typography_settings['fluid'] ) && 486 ( true === $typography_settings['fluid'] || is_array( $typography_settings['fluid'] ) ) 487 ) { 488 $should_use_fluid_typography = true; 489 } 490 491 if ( ! $should_use_fluid_typography ) { 492 return $preset['size']; 493 } 494 495 $fluid_settings = isset( $typography_settings['fluid'] ) && is_array( $typography_settings['fluid'] ) 496 ? $typography_settings['fluid'] 497 : array(); 498 499 // Defaults. 500 $default_maximum_viewport_width = '1600px'; 501 $default_minimum_viewport_width = '768px'; 502 $default_minimum_font_size_factor = 0.75; 503 $default_scale_factor = 1; 504 $has_min_font_size = isset( $fluid_settings['minFontSize'] ) && ! empty( wp_get_typography_value_and_unit( $fluid_settings['minFontSize'] ) ); 505 $default_minimum_font_size_limit = $has_min_font_size ? $fluid_settings['minFontSize'] : '14px'; 506 507 // Font sizes. 508 $fluid_font_size_settings = isset( $preset['fluid'] ) ? $preset['fluid'] : null; 509 510 // A font size has explicitly bypassed fluid calculations. 511 if ( false === $fluid_font_size_settings ) { 512 return $preset['size']; 513 } 514 515 // Try to grab explicit min and max fluid font sizes. 516 $minimum_font_size_raw = isset( $fluid_font_size_settings['min'] ) ? $fluid_font_size_settings['min'] : null; 517 $maximum_font_size_raw = isset( $fluid_font_size_settings['max'] ) ? $fluid_font_size_settings['max'] : null; 518 519 // Font sizes. 520 $preferred_size = wp_get_typography_value_and_unit( $preset['size'] ); 521 522 // Protects against unsupported units. 523 if ( empty( $preferred_size['unit'] ) ) { 524 return $preset['size']; 525 } 526 527 /* 528 * Normalizes the minimum font size limit according to the incoming unit, 529 * in order to perform comparative checks. 530 */ 531 $minimum_font_size_limit = wp_get_typography_value_and_unit( 532 $default_minimum_font_size_limit, 533 array( 534 'coerce_to' => $preferred_size['unit'], 535 ) 536 ); 537 538 // Don't enforce minimum font size if a font size has explicitly set a min and max value. 539 if ( ! empty( $minimum_font_size_limit ) && ( ! $minimum_font_size_raw && ! $maximum_font_size_raw ) ) { 540 /* 541 * If a minimum size was not passed to this function 542 * and the user-defined font size is lower than $minimum_font_size_limit, 543 * do not calculate a fluid value. 544 */ 545 if ( $preferred_size['value'] <= $minimum_font_size_limit['value'] ) { 546 return $preset['size']; 547 } 548 } 549 550 // If no fluid max font size is available use the incoming value. 551 if ( ! $maximum_font_size_raw ) { 552 $maximum_font_size_raw = $preferred_size['value'] . $preferred_size['unit']; 553 } 554 555 /* 556 * If no minimumFontSize is provided, create one using 557 * the given font size multiplied by the min font size scale factor. 558 */ 559 if ( ! $minimum_font_size_raw ) { 560 $calculated_minimum_font_size = round( 561 $preferred_size['value'] * $default_minimum_font_size_factor, 562 3 563 ); 564 565 // Only use calculated min font size if it's > $minimum_font_size_limit value. 566 if ( ! empty( $minimum_font_size_limit ) && $calculated_minimum_font_size <= $minimum_font_size_limit['value'] ) { 567 $minimum_font_size_raw = $minimum_font_size_limit['value'] . $minimum_font_size_limit['unit']; 568 } else { 569 $minimum_font_size_raw = $calculated_minimum_font_size . $preferred_size['unit']; 570 } 571 } 572 573 $fluid_font_size_value = wp_get_computed_fluid_typography_value( 574 array( 575 'minimum_viewport_width' => $default_minimum_viewport_width, 576 'maximum_viewport_width' => $default_maximum_viewport_width, 577 'minimum_font_size' => $minimum_font_size_raw, 578 'maximum_font_size' => $maximum_font_size_raw, 579 'scale_factor' => $default_scale_factor, 580 ) 581 ); 582 583 if ( ! empty( $fluid_font_size_value ) ) { 584 return $fluid_font_size_value; 585 } 586 587 return $preset['size']; 588 } 589 590 // Register the block support. 591 WP_Block_Supports::get_instance()->register( 592 'typography', 593 array( 594 'register_attribute' => 'wp_register_typography_support', 595 'apply' => 'wp_apply_typography_support', 596 ) 597 );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sun Jun 4 08:20:02 2023 | Cross-referenced by PHPXref |