Pass extra CSS classes to the block
This commit is contained in:
parent
5c980cc629
commit
3fb54a67ae
|
@ -687,6 +687,25 @@ class StyleAttributesUtils {
|
|||
return self::EMPTY_STYLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extra CSS classes from attributes.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @return array
|
||||
*/
|
||||
public static function get_classes_from_attributes( $attributes ) {
|
||||
|
||||
$extra_css_classes = $attributes['className'] ?? '';
|
||||
|
||||
if ( '' !== $extra_css_classes ) {
|
||||
return array(
|
||||
'class' => $extra_css_classes,
|
||||
'style' => null,
|
||||
);
|
||||
}
|
||||
return self::EMPTY_STYLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get classes and styles from attributes.
|
||||
*
|
||||
|
@ -717,6 +736,7 @@ class StyleAttributesUtils {
|
|||
'text_color' => self::get_text_color_class_and_style( $attributes ),
|
||||
'text_decoration' => self::get_text_decoration_class_and_style( $attributes ),
|
||||
'text_transform' => self::get_text_transform_class_and_style( $attributes ),
|
||||
'extra_classes' => self::get_classes_from_attributes( $attributes ),
|
||||
);
|
||||
|
||||
if ( ! empty( $properties ) ) {
|
||||
|
|
Loading…
Reference in New Issue