PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 1.6.4
Kubio AI Page Builder v1.6.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 / lib / src / Core / Blocks / Query / QueryLoopItemBase.php
kubio / lib / src / Core / Blocks / Query Last commit date
QueryLoopBase.php 3 years ago QueryLoopItemBase.php 3 years ago
QueryLoopItemBase.php
86 lines
1 <?php
2
3 namespace Kubio\Core\Blocks\Query;
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 abstract class QueryLoopItemBase extends BlockContainerBase {
12
13 const CONTAINER = 'container';
14 const INNER = 'inner';
15 const ALIGN = 'align';
16 const VSPACE = 'v-space';
17 const TYPOGRAPHY_HOLDERS = 'typographyHolders';
18
19 public function mapDynamicStyleToElements() {
20 $dynamic_styles = array();
21 $space_by_media = $this->getPropByMedia(
22 'layout.vSpace',
23 array()
24 );
25
26 $typographyHoldersByMedia = $this->getStyleByMedia(
27 'typography.holders',
28 array(),
29 array(
30 'styledComponent' => $this->getDefaultElement(),
31 )
32 );
33
34 $dynamic_styles[ self::TYPOGRAPHY_HOLDERS ] = DynamicStyles::typographyHolders( $typographyHoldersByMedia );
35 $dynamic_styles[ self::VSPACE ] = DynamicStyles::vSpace( $space_by_media );
36
37 return $dynamic_styles;
38 }
39
40 public function mapPropsToElements() {
41 $row_block = Registry::getInstance()->getLastBlockOfName( $this->loopBlockName() );
42
43 $column_width_by_media = $this->getStyleByMedia(
44 'columnWidth',
45 array(),
46 array(
47 'styledComponent' => self::CONTAINER,
48 'local' => true,
49 )
50 );
51
52 $layout_media = $this->getPropByMedia( 'layout' );
53 $row_layout_by_media = $row_block ? $row_block->getPropByMedia( 'layout' ) : array();
54
55 $column_width = $column_width_by_media['desktop'];
56 $layout_helper = new LayoutHelper( $layout_media, $row_layout_by_media );
57
58 $container_cls = LodashBasic::concat(
59 $layout_helper->getColumnLayoutClasses( $column_width_by_media ),
60 $layout_helper->getInheritedColumnVAlignClasses(),
61 get_post_class()
62 );
63
64 $equal_width = LodashBasic::get( $row_layout_by_media, 'desktop.equalWidth', false );
65
66 $align_cls = LodashBasic::concat(
67 $layout_helper->getColumnContentFlexBasis( $equal_width, $column_width ),
68 $layout_helper->getSelfVAlignClasses()
69 );
70
71 $inner = $layout_helper->getColumnInnerGapsClasses();
72
73 $map = array();
74 $map[ self::CONTAINER ] = array( 'className' => $container_cls );
75 $map[ self::ALIGN ] = array( 'className' => $align_cls );
76 $map[ self::INNER ] = array( 'className' => $inner );
77
78 return $map;
79 }
80
81 /**
82 * @return string
83 */
84 public abstract function loopBlockName();
85 }
86