PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.0
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
ablocks / includes / blocks / menu-child-mega / block.php

block.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.9.0, at includes/blocks/menu-child-mega/block.php

69 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ABlocks\Blocks\MenuChildMega;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 use ABlocks\Classes\BlockBaseAbstract;
9 use ABlocks\Classes\CssGenerator;
10 use ABlocks\Controls\Range;
11
12 class Block extends BlockBaseAbstract {
13 protected $parent_block_name = 'menu';
14 protected $block_name = 'menu-child-mega';
15
16 public function build_css( $attributes ) {
17
18 $css_generator = new CssGenerator( $attributes, $this->block_name );
19 // Wrapper CSS
20 $css_generator->add_class_styles(
21 '{{WRAPPER}}',
22 $this->get_wrapper_css( $attributes, '' ),
23 $this->get_wrapper_css( $attributes, 'Tablet' ),
24 $this->get_wrapper_css( $attributes, 'Mobile' )
25 );
26 return $css_generator->generate_css();
27 }
28 private function get_wrapper_css( $attributes, $device = '' ) {
29 $css = [];
30 $padding = isset( $attributes['padding'] ) ? $attributes['padding'] : '';
31 if ( isset( $attributes['height'] ) && $attributes['height'] > 0 ) {
32 $css['overflow-y'] = 'auto';
33 $css['overflow-x'] = 'hidden';
34 }
35 return array_merge(
36 Range::get_css([
37 'attributeValue' => $attributes['width'],
38 'attribute_object_key' => 'value',
39 'isResponsive' => true,
40 'defaultValue' => 100,
41 'hasUnit' => true,
42 'unitDefaultValue' => '%',
43 'property' => 'width',
44 'device' => $device,
45 ]),
46 Range::get_css([
47 'attributeValue' => $attributes['height'],
48 'attribute_object_key' => 'value',
49 'isResponsive' => true,
50 'hasUnit' => true,
51 'unitDefaultValue' => 'px',
52 'property' => 'height',
53 'device' => $device,
54 ]),
55 Range::get_css([
56 'attributeValue' => $attributes['positionX'],
57 'attribute_object_key' => 'value',
58 'isResponsive' => true,
59 'defaultValue' => 0,
60 'property' => 'left',
61 'unitDefaultValue' => '%',
62 'hasUnit' => true,
63 'device' => $device,
64 ]),
65 $css
66 );
67 }
68 }
69