PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.4
Kubio AI Page Builder v2.8.4
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / build / block-library / blocks / column / index.php
kubio / build / block-library / blocks / column Last commit date
block.json 2 years ago index.php 1 month ago
index.php
77 lines
1 <?php
2
3 namespace Kubio\Blocks;
4
5 use Kubio\Core\Blocks\BlockContainerBase;
6 use Kubio\Core\Layout\LayoutHelper;
7 use Kubio\Core\LodashBasic;
8 use Kubio\Core\Registry;
9 use Kubio\Core\StyleManager\DynamicStyles;
10
11
12 class ColumnBlock extends BlockContainerBase {
13
14
15 const CONTAINER = 'container';
16 const INNER = 'inner';
17 const ALIGN = 'align';
18 const VSPACE = 'v-space';
19
20
21 public function mapDynamicStyleToElements() {
22 $dynamicStyles = array();
23 $spaceByMedia = $this->getPropByMedia(
24 'layout.vSpace',
25 array()
26 );
27
28 $dynamicStyles[ self::VSPACE ] = DynamicStyles::vSpace( $spaceByMedia );
29
30 return $dynamicStyles;
31 }
32
33 public function mapPropsToElements() {
34 $row_block = Registry::getInstance()->getLastBlockOfName( 'kubio/row' );
35
36 $columnWidthByMedia = $this->getStyleByMedia(
37 'columnWidth',
38 array(),
39 array(
40 'styledComponent' => self::CONTAINER,
41 'local' => true,
42 )
43 );
44
45 $layoutByMedia = $this->getPropByMedia( 'layout' );
46 $rowLayoutByMedia = $row_block ? $row_block->getPropByMedia( 'layout' ) : array();
47
48 $columnWidth = $columnWidthByMedia['desktop'];
49 $layoutHelper = new LayoutHelper( $layoutByMedia, $rowLayoutByMedia );
50
51 $container_cls = LodashBasic::concat(
52 $layoutHelper->getColumnLayoutClasses( $columnWidthByMedia ),
53 $layoutHelper->getInheritedColumnVAlignClasses()
54 );
55
56 $equalWidth = LodashBasic::get( $rowLayoutByMedia, 'desktop.equalWidth', false );
57
58 $align_cls = LodashBasic::concat(
59 $layoutHelper->getColumnContentFlexBasis( $equalWidth, $columnWidth ),
60 $layoutHelper->getSelfVAlignClasses()
61 );
62
63 $inner = $layoutHelper->getColumnInnerGapsClasses();
64
65 $map = array();
66 $map[ self::CONTAINER ] = array( 'className' => $container_cls );
67 $map[ self::INNER ] = array( 'className' => $inner );
68 $map[ self::ALIGN ] = array( 'className' => $align_cls );
69 return $map;
70 }
71 }
72
73 Registry::registerBlock(
74 __DIR__,
75 ColumnBlock::class
76 );
77