WordPress Version: 6.1
/**
* Returns typography styles to be included in an HTML style tag.
* This excludes text-decoration, which is applied only to the label and button elements of the search block.
*
* @param array $attributes The block attributes.
*
* @return string A string of typography CSS declarations.
*/
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']);
}
if (!empty($attributes['style']['typography']['letterSpacing'])) {
$typography_styles[] = sprintf('letter-spacing: %s;', $attributes['style']['typography']['letterSpacing']);
}
if (!empty($attributes['style']['typography']['fontWeight'])) {
$typography_styles[] = sprintf('font-weight: %s;', $attributes['style']['typography']['fontWeight']);
}
if (!empty($attributes['style']['typography']['fontStyle'])) {
$typography_styles[] = sprintf('font-style: %s;', $attributes['style']['typography']['fontStyle']);
}
if (!empty($attributes['style']['typography']['lineHeight'])) {
$typography_styles[] = sprintf('line-height: %s;', $attributes['style']['typography']['lineHeight']);
}
if (!empty($attributes['style']['typography']['textTransform'])) {
$typography_styles[] = sprintf('text-transform: %s;', $attributes['style']['typography']['textTransform']);
}
return implode('', $typography_styles);
}