Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks

Media_Text::get_vertical_alignment_from_attributesprivateWC 1.0

Get the vertical alignment value from block attributes.

Method of the class: Media_Text{}

No Hooks.

Returns

String. CSS vertical-align value.

Usage

// private - for code of main (parent) class only
$result = $this->get_vertical_alignment_from_attributes( $block_attrs ): string;
$block_attrs(array) (required)
Block attributes.

Media_Text::get_vertical_alignment_from_attributes() code WC 10.5.0

private function get_vertical_alignment_from_attributes( array $block_attrs ): string {
	$vertical_alignment = $block_attrs['verticalAlignment'] ?? 'middle';

	// Convert WordPress alignment values to CSS values.
	switch ( $vertical_alignment ) {
		case 'top':
			return 'top';
		case 'center':
			return 'middle';
		case 'bottom':
			return 'bottom';
		default:
			return 'middle';
	}
}