Changeset 54260 for trunk/src/wp-includes/deprecated.php
- Timestamp:
- 09/20/2022 03:41:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/deprecated.php
r54157 r54260 4457 4457 return $metadata; 4458 4458 } 4459 4460 /** 4461 * Generates an inline style for a typography feature e.g. text decoration, 4462 * text transform, and font style. 4463 * 4464 * @since 5.8.0 4465 * @access private 4466 * @deprecated 6.1.0 Use wp_style_engine_get_styles() introduced in 6.1.0. 4467 * 4468 * @see wp_style_engine_get_styles() 4469 * 4470 * @param array $attributes Block's attributes. 4471 * @param string $feature Key for the feature within the typography styles. 4472 * @param string $css_property Slug for the CSS property the inline style sets. 4473 * @return string CSS inline style. 4474 */ 4475 function wp_typography_get_css_variable_inline_style( $attributes, $feature, $css_property ) { 4476 _deprecated_function( __FUNCTION__, '6.1.0', 'wp_style_engine_get_styles()' ); 4477 4478 // Retrieve current attribute value or skip if not found. 4479 $style_value = _wp_array_get( $attributes, array( 'style', 'typography', $feature ), false ); 4480 if ( ! $style_value ) { 4481 return; 4482 } 4483 4484 // If we don't have a preset CSS variable, we'll assume it's a regular CSS value. 4485 if ( strpos( $style_value, "var:preset|{$css_property}|" ) === false ) { 4486 return sprintf( '%s:%s;', $css_property, $style_value ); 4487 } 4488 4489 /* 4490 * We have a preset CSS variable as the style. 4491 * Get the style value from the string and return CSS style. 4492 */ 4493 $index_to_splice = strrpos( $style_value, '|' ) + 1; 4494 $slug = substr( $style_value, $index_to_splice ); 4495 4496 // Return the actual CSS inline style e.g. `text-decoration:var(--wp--preset--text-decoration--underline);`. 4497 return sprintf( '%s:var(--wp--preset--%s--%s);', $css_property, $css_property, $slug ); 4498 }
Note: See TracChangeset
for help on using the changeset viewer.