Automattic\WooCommerce\Blocks\BlockTypes
Breadcrumbs::get_theme_font_size_classes_and_styles
Gets font size classes and styles from theme.json block styles.
Метод класса: Breadcrumbs{}
Хуков нет.
Возвращает
array. The font size classes and styles.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_theme_font_size_classes_and_styles();
Код Breadcrumbs::get_theme_font_size_classes_and_styles() Breadcrumbs::get theme font size classes and styles WC 11.2.1
private function get_theme_font_size_classes_and_styles() {
$theme_font_size = wp_get_global_styles(
array( 'blocks', 'woocommerce/breadcrumbs', 'typography', 'fontSize' )
);
if ( ! is_string( $theme_font_size ) || '' === $theme_font_size ) {
return array(
'class' => null,
'style' => null,
);
}
$preset_prefix = 'var(--wp--preset--font-size--';
if ( str_starts_with( $theme_font_size, $preset_prefix ) ) {
$slug = rtrim( substr( $theme_font_size, strlen( $preset_prefix ) ), ')' );
return array(
'class' => sprintf( 'has-font-size has-%s-font-size', $slug ),
'style' => null,
);
}
return array(
'class' => null,
'style' => sprintf( 'font-size: %s;', $theme_font_size ),
);
}