Automattic\WooCommerce\Blocks\Utils
StyleAttributesUtils::get_align_class_and_style
Get class and style for align from attributes.
Method of the class: StyleAttributesUtils{}
No Hooks.
Returns
Array.
Usage
$result = StyleAttributesUtils::get_align_class_and_style( $attributes );
- $attributes(array) (required)
- Block attributes.
StyleAttributesUtils::get_align_class_and_style() StyleAttributesUtils::get align class and style code WC 10.8.1
public static function get_align_class_and_style( $attributes ) {
$align_attribute = $attributes['align'] ?? null;
if ( 'wide' === $align_attribute ) {
return array(
'class' => 'alignwide',
'style' => null,
);
}
if ( 'full' === $align_attribute ) {
return array(
'class' => 'alignfull',
'style' => null,
);
}
if ( 'left' === $align_attribute ) {
return array(
'class' => 'alignleft',
'style' => null,
);
}
if ( 'right' === $align_attribute ) {
return array(
'class' => 'alignright',
'style' => null,
);
}
if ( 'center' === $align_attribute ) {
return array(
'class' => 'aligncenter',
'style' => null,
);
}
return self::EMPTY_STYLE;
}