wp_get_typography_font_size_value example

$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;
}

/** * Returns the top-level submenu SVG chevron icon. * * @return string */


            // Calculates fluid typography rules where available.             if ( 'font-size' === $css_property ) {
                /* * wp_get_typography_font_size_value() will check * if fluid typography has been activated and also * whether the incoming value can be converted to a fluid value. * Values that already have a clamp() function will not pass the test, * and therefore the original $value will be returned. */
                $value = wp_get_typography_font_size_value( array( 'size' => $value ) );
            }

            $declarations[] = array(
                'name'  => $css_property,
                'value' => $value,
            );
        }

        // If a variable value is added to the root, the corresponding property should be removed.         foreach ( $root_variable_duplicates as $duplicate ) {
            $discard = array_search( $duplicatearray_column( $declarations, 'name' ), true );
            

function get_typography_styles_for_block_core_search( $attributes ) {
    $typography_styles = array();

    // Add typography styles.     if ( ! empty( $attributes['style']['typography']['fontSize'] ) ) {
        $typography_styles[] = sprintf(
            'font-size: %s;',
            wp_get_typography_font_size_value(
                array(
                    'size' => $attributes['style']['typography']['fontSize'],
                )
            )
        );

    }

    if ( ! empty( $attributes['style']['typography']['fontFamily'] ) ) {
        $typography_styles[] = sprintf( 'font-family: %s;', $attributes['style']['typography']['fontFamily'] );
    }

    
$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;
}

/** * Returns the top-level submenu SVG chevron icon. * * @return string */
$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;
}

/** * Outputs Page list markup from an array of pages with nested children. * * @param boolean $open_submenus_on_click Whether to open submenus on click instead of hover. * @param boolean $show_submenu_icons Whether to show submenu indicator icons. * @param boolean $is_navigation_child If block is a child of Navigation block. * @param array $nested_pages The array of nested pages. * @param boolean $is_nested Whether the submenu is nested or not. * @param array $active_page_ancestor_ids An array of ancestor ids for active page. * @param array $colors Color information for overlay styles. * @param integer $depth The nesting depth. * * @return string List markup. */
$should_skip_text_transform  = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' );
    $should_skip_letter_spacing  = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'letterSpacing' );

    $typography_block_styles = array();
    if ( $has_font_size_support && ! $should_skip_font_size ) {
        $preset_font_size                    = array_key_exists( 'fontSize', $block_attributes )
            ? "var:preset|font-size|{$block_attributes['fontSize']}"
            : null;
        $custom_font_size                    = isset( $block_attributes['style']['typography']['fontSize'] )
            ? $block_attributes['style']['typography']['fontSize']
            : null;
        $typography_block_styles['fontSize'] = $preset_font_size ? $preset_font_size : wp_get_typography_font_size_value(
            array(
                'size' => $custom_font_size,
            )
        );
    }

    if ( $has_font_family_support && ! $should_skip_font_family ) {
        $preset_font_family                    = array_key_exists( 'fontFamily', $block_attributes )
            ? "var:preset|font-family|{$block_attributes['fontFamily']}"
            : null;
        $custom_font_family                    = isset( $block_attributes['style']['typography']['fontFamily'] )
            ?
Home | Imprint | This part of the site doesn't use cookies.