block_core_navigation_build_css_font_sizes() – 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.

You appear to be a bot. Output may be restricted

Description

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.

Usage

$array = block_core_navigation_build_css_font_sizes( $attributes );

Parameters

$attributes
( array ) required – Navigation block attributes.

Returns

array Font size CSS classes and inline styles.

Source

File name: wordpress/wp-includes/blocks/navigation.php
Lines:

1 to 20 of 20
function block_core_navigation_build_css_font_sizes( $attributes ) {
  // CSS classes.
  $font_sizes = array(
    'css_classes'   => array(),
    'inline_styles' => '',
  );

  $has_named_font_size  = array_key_exists( 'fontSize', $attributes );
  $has_custom_font_size = array_key_exists( 'customFontSize', $attributes );

  if ( $has_named_font_size ) {
    // Add the font size class.
    $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $attributes['fontSize'] );
  } elseif ( $has_custom_font_size ) {
    // Add the custom font size inline style.
    $font_sizes['inline_styles'] = sprintf( 'font-size: %spx;', $attributes['customFontSize'] );
  }

  return $font_sizes;
}
 

 View on GitHub View on Trac