Automattic\WooCommerce\Blocks\BlockTypes
Breadcrumbs::get_font_size_classes_and_styles
Gets font size classes and styles for the breadcrumbs block.
Note: This implementation intentionally avoids using StyleAttributesUtils::get_font_size_class_and_style() and get_block_wrapper_attributes() to ensure style attributes take precedence over the class attribute fontSize. This is needed because the block.json defines a default fontSize, which is considered an anti-pattern since styles should be defined by themes and plugins instead.
Метод класса: Breadcrumbs{}
Хуков нет.
Возвращает
Массив. The font size classes and styles.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_font_size_classes_and_styles( $attributes );
- $attributes(массив) (обязательный)
- The block attributes.
Код Breadcrumbs::get_font_size_classes_and_styles() Breadcrumbs::get font size classes and styles WC 10.3.6
private function get_font_size_classes_and_styles( $attributes ) {
$font_size = $attributes['fontSize'] ?? '';
$custom_font_size = $attributes['style']['typography']['fontSize'] ?? '';
if ( ! $font_size && '' === $custom_font_size ) {
return array(
'class' => null,
'style' => null,
);
}
if ( '' !== $custom_font_size ) {
return array(
'class' => null,
'style' => sprintf( 'font-size: %s;', $custom_font_size ),
);
}
return array(
'class' => sprintf( 'has-font-size has-%s-font-size', $font_size ),
'style' => null,
);
}