Query
1 year ago
BlockBase.php
1 year ago
BlockContainerBase.php
1 year ago
BlockElement.php
3 years ago
BlockStyle.php
4 years ago
DataHelper.php
1 year ago
TemplatePartBlockBase.php
1 year ago
BlockContainerBase.php
59 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kubio\Core\Blocks; |
| 4 | |
| 5 | use Kubio\Config; |
| 6 | |
| 7 | class BlockContainerBase extends BlockBase { |
| 8 | |
| 9 | |
| 10 | public $backgroundElement; |
| 11 | public $separatorElement; |
| 12 | |
| 13 | public function __construct( $block, $autoload, $context ) { |
| 14 | parent::__construct( $block, $autoload, $context ); |
| 15 | $this->backgroundElement = $this->findElementBy( 'supports.background', true ); |
| 16 | $this->separatorElement = $this->findElementBy( 'supports.separator', true ); |
| 17 | parent::create(); |
| 18 | } |
| 19 | |
| 20 | public function backgroundByMedia() { |
| 21 | return $this->getStyleByMedia( |
| 22 | 'background', |
| 23 | Config::value( 'props.background.default' ), |
| 24 | array( |
| 25 | 'styledComponent' => $this->backgroundElement, |
| 26 | ) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | public function separators() { |
| 31 | return $this->getStyle( |
| 32 | 'separators', |
| 33 | array(), |
| 34 | array( |
| 35 | 'styledComponent' => $this->separatorElement, |
| 36 | ) |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | public function separatorTopEnabledByMedia() { |
| 41 | return $this->getStyleByMedia( |
| 42 | 'separators.top.enabled', |
| 43 | false, |
| 44 | array( |
| 45 | 'styledComponent' => $this->separatorElement, |
| 46 | ) |
| 47 | ); |
| 48 | } |
| 49 | public function separatorBottomEnabledByMedia() { |
| 50 | return $this->getStyleByMedia( |
| 51 | 'separators.bottom.enabled', |
| 52 | false, |
| 53 | array( |
| 54 | 'styledComponent' => $this->separatorElement, |
| 55 | ) |
| 56 | ); |
| 57 | } |
| 58 | } |
| 59 |