Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks
Product_Sale_Badge::get_position_style
Get positioning styles based on alignment.
Method of the class: Product_Sale_Badge{}
No Hooks.
Returns
Array.
Usage
// private - for code of main (parent) class only $result = $this->get_position_style( $align ): array;
- $align(string) (required)
- Alignment value.
Product_Sale_Badge::get_position_style() Product Sale Badge::get position style code WC 10.5.0
private function get_position_style( string $align ): array {
switch ( $align ) {
case 'left':
return array(
'text-align' => 'left',
'margin-right' => 'auto',
);
case 'center':
return array(
'text-align' => 'center',
'margin-left' => 'auto',
'margin-right' => 'auto',
);
case 'right':
return array(
'text-align' => 'right',
'margin-left' => 'auto',
);
default:
return array(
'text-align' => 'left',
);
}
}