PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.1
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.1
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.1, at includes/blocks/menu-child-mega/block.php

65 lines 1.7 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 use ABlocks\Classes\BlockBaseAbstract;
5 use ABlocks\Classes\CssGenerator;
6 use ABlocks\Controls\Range;
7
8 class Block extends BlockBaseAbstract {
9 protected $parent_block_name = 'menu';
10 protected $block_name = 'menu-child-mega';
11
12 public function build_css( $attributes ) {
13
14 $css_generator = new CssGenerator( $attributes, $this->block_name );
15 // Wrapper CSS
16 $css_generator->add_class_styles(
17 '{{WRAPPER}}',
18 $this->get_wrapper_css( $attributes, '' ),
19 $this->get_wrapper_css( $attributes, 'Tablet' ),
20 $this->get_wrapper_css( $attributes, 'Mobile' )
21 );
22 return $css_generator->generate_css();
23 }
24 private function get_wrapper_css( $attributes, $device = '' ) {
25 $css = [];
26 $padding = isset( $attributes['padding'] ) ? $attributes['padding'] : '';
27 if ( isset( $attributes['height'] ) && $attributes['height'] > 0 ) {
28 $css['overflow-y'] = 'auto';
29 $css['overflow-x'] = 'hidden';
30 }
31 return array_merge(
32 Range::get_css([
33 'attributeValue' => $attributes['width'],
34 'attribute_object_key' => 'value',
35 'isResponsive' => true,
36 'defaultValue' => 100,
37 'hasUnit' => true,
38 'unitDefaultValue' => '%',
39 'property' => 'width',
40 'device' => $device,
41 ]),
42 Range::get_css([
43 'attributeValue' => $attributes['height'],
44 'attribute_object_key' => 'value',
45 'isResponsive' => true,
46 'hasUnit' => true,
47 'unitDefaultValue' => 'px',
48 'property' => 'height',
49 'device' => $device,
50 ]),
51 Range::get_css([
52 'attributeValue' => $attributes['positionX'],
53 'attribute_object_key' => 'value',
54 'isResponsive' => true,
55 'defaultValue' => 0,
56 'property' => 'left',
57 'unitDefaultValue' => '%',
58 'hasUnit' => true,
59 'device' => $device,
60 ]),
61 $css
62 );
63 }
64 }
65