block_core_navigation_link_build_css_font_sizes()
Deprecated since 7.0.0. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.
Build an array with CSS classes and inline styles defining the font sizes which will be applied to the navigation markup in the front-end.
This function is no longer used internally and is kept only for backward compatibility with third-party code that may call it directly.
No Hooks.
Returns
array. Font size CSS classes and inline styles.
Usage
block_core_navigation_link_build_css_font_sizes( $context );
- $context(array) (required)
- Navigation block context.
Changelog
| Since 5.9.0 | Introduced. |
| Deprecated since | 7.0.0 |
block_core_navigation_link_build_css_font_sizes() block core navigation link build css font sizes code WP 7.1
function block_core_navigation_link_build_css_font_sizes( $context ) {
_deprecated_function( __FUNCTION__, '7.0.0' );
// CSS classes.
$font_sizes = array(
'css_classes' => array(),
'inline_styles' => '',
);
$has_named_font_size = array_key_exists( 'fontSize', $context );
$has_custom_font_size = isset( $context['style']['typography']['fontSize'] );
if ( $has_named_font_size ) {
// Add the font size class.
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
} elseif ( $has_custom_font_size ) {
// Add the custom font size inline style.
$font_sizes['inline_styles'] = sprintf(
'font-size: %s;',
wp_get_typography_font_size_value(
array(
'size' => $context['style']['typography']['fontSize'],
)
)
);
}
return $font_sizes;
}