index.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kubio\Blocks; |
| 4 | |
| 5 | use Kubio\Core\Blocks\BlockContainerBase; |
| 6 | use Kubio\Core\Registry; |
| 7 | use Kubio\Core\Styles\FlexAlign; |
| 8 | |
| 9 | class SectionBlock extends BlockContainerBase { |
| 10 | |
| 11 | |
| 12 | // move to json |
| 13 | static $WidthTypesClasses = array( |
| 14 | 'full-width' => 'h-section-fluid-container', |
| 15 | 'boxed' => 'h-section-boxed-container', |
| 16 | ); |
| 17 | |
| 18 | |
| 19 | public function mapPropsToElements() { |
| 20 | $verticalAlignByMedia = $this->getPropByMedia( 'verticalAlign' ); |
| 21 | $verticalAlignClasses = FlexAlign::getVAlignClasses( $verticalAlignByMedia ); |
| 22 | $width = $this->getProp( 'width', 'boxed' ); |
| 23 | $map = array(); |
| 24 | $map['outer'] = array( |
| 25 | 'className' => $verticalAlignClasses, |
| 26 | ); |
| 27 | $map['inner'] = array( 'className' => isset( self::$WidthTypesClasses[ $width ] ) ? self::$WidthTypesClasses[ $width ] : '' ); |
| 28 | return $map; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | Registry::registerBlock( __DIR__, SectionBlock::class ); |
| 33 |