PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.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 All 81 releases
← All changes | includes/blocks/advance-lists/block.php +14 -30 2.9.1 → 2.14.0 View file →
@@ -1,7 +1,11 @@
1 1 <?php
2 2 namespace ABlocks\Blocks\AdvanceLists;
3 3
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
7 +
4 8 use ABlocks\Classes\BlockBaseAbstract;
5 9 use ABlocks\Classes\CssGenerator;
6 10 use ABlocks\Controls\Alignment;
7 11 use ABlocks\Controls\Dimensions;
@@ -10,8 +14,9 @@
10 14 use ABlocks\Controls\TextStroke;
11 15 use ABlocks\Controls\Width;
12 16 use ABlocks\Controls\Border;
13 17 use ABlocks\Controls\Range;
18 +use ABlocks\Controls\Color;
14 19
15 20 class Block extends BlockBaseAbstract {
16 21
17 22 protected $block_name = 'advance-lists';
@@ -18,15 +23,8 @@
18 23
19 24 public function build_css( $attributes ) {
20 25 // Generate CSS
21 26 $css_generator = new CssGenerator( $attributes );
22 - // Wrapper CSS
23 - $css_generator->add_class_styles(
24 - '{{WRAPPER}}',
25 - $this->get_wrapper_css( $attributes, '' ),
26 - $this->get_wrapper_css( $attributes, 'Tablet' ),
27 - $this->get_wrapper_css( $attributes, 'Mobile' ),
28 - );
29 27
30 28 $css_generator->add_class_styles(
31 29 '{{WRAPPER}}.ablocks-block--advance-lists > .ablocks-block-container',
32 30 $this->get_container_css( $attributes, '' ),
@@ -34,15 +32,11 @@
34 32 $this->get_container_css( $attributes, 'Mobile' ),
35 33 );
36 34
37 35 // text
38 - $desktop_paragraph_text_style = $this->get_paragraph_text_css( $attributes );
39 - if ( ! empty( $attributes['textColor'] ) ) {
40 - $desktop_paragraph_text_style['color'] = $attributes['textColor'];
41 - }
42 36 $css_generator->add_class_styles(
43 37 '{{WRAPPER}} .ablocks-block-container .ablocks-advance-list-item-text',
44 - $desktop_paragraph_text_style,
38 + $this->get_paragraph_text_css( $attributes ),
45 39 $this->get_paragraph_text_css( $attributes, 'Tablet' ),
46 40 $this->get_paragraph_text_css( $attributes, 'Mobile' ),
47 41 );
48 42 $css_generator->add_class_styles(
@@ -61,17 +55,8 @@
61 55 );
62 56 return $css_generator->generate_css();
63 57 }
64 58
65 - public function get_wrapper_css( $attributes, $device = '' ) {
66 - $typography = isset( $attributes['typography'] ) ? $attributes['typography'] : '';
67 - $alignment = isset( $attributes['alignment'] ) ? $attributes['alignment'] : '';
68 - return array_merge(
69 - Alignment::get_css( $alignment, 'text-align', $device ),
70 - Typography::get_css( $typography, $device ),
71 - );
72 - }
73 -
74 59 public function get_container_css( $attributes, $device = '' ) {
75 60 $css = [];
76 61 if ( ! empty( $attributes['listsDirection'][ 'value' . $device ] ) ) {
77 62 $css['flex-direction'] = $attributes['listsDirection'][ 'value' . $device ];
@@ -79,8 +64,9 @@
79 64 $listsDirection = ! empty( $attributes['listsDirection'][ 'value' . $device ] ) && $attributes['listsDirection'][ 'value' . $device ];
80 65 $alignment = isset( $attributes['alignment'] ) ? $attributes['alignment'] : '';
81 66 return array_merge(
82 67 $css,
68 + Alignment::get_css( $alignment, 'text-align', $device ),
83 69 Alignment::get_css( $alignment, ( $listsDirection && $attributes['listsDirection'][ 'value' . $device ] === 'row' ) ? 'justify-content' : 'align-items', $device ),
84 70 Range::get_css([
85 71 'attributeValue' => $attributes['columnGap'],
86 72 'attribute_object_key' => 'value',
@@ -94,30 +80,28 @@
94 80 );
95 81 }
96 82
97 83 public function get_paragraph_text_css( $attributes, $device = '' ) {
84 + $typographyValueGlobal = ! empty( $attributes['listTypographyGlobal'] ) ? $attributes['listTypographyGlobal'] : '';
85 + $typography_value = isset( $attributes['listTypography'] ) ? $attributes['listTypography'] : [];
98 86 return array_merge(
99 - isset( $attributes['listTypography'] ) ? Typography::get_css( $attributes['listTypography'], '', $device ) : [],
87 + [ 'color' => Color::get_css( isset( $attributes['textColor'] ) ? $attributes['textColor'] : '' ) ],
88 + Typography::get_css( $typography_value, '', $device, $typographyValueGlobal ),
100 89 isset( $attributes['listTextStroke'] ) ? TextStroke::get_css( $attributes['listTextStroke'], '', $device ) : [],
101 90 isset( $attributes['listTextShadow'] ) ? TextShadow::get_css( $attributes['listTextShadow'] ) : [],
102 91 );
103 92 }
104 93 public function get_paragraph_drop_text_css( $attributes, $device = '' ) {
105 - $css = [];
106 - if ( ! empty( $attributes['dropCapsTextColor'] ) ) {
107 - $css['color'] = $attributes['dropCapsTextColor'];
108 - }
109 - return $css;
94 + return [ 'color' => Color::get_css( isset( $attributes['dropCapsTextColor'] ) ? $attributes['dropCapsTextColor'] : '' ) ];
110 95 }
111 96
112 97 public function get_divider_css( $attributes, $device = '' ) {
113 98 $css = [];
114 99 $divider_width = isset( $attributes['width'][ 'value' . $device ] ) ? $attributes['width'][ 'value' . $device ] : 60;
115 - $divider_color = isset( $attributes['color'] ) ? $attributes['color'] : '#000000';
116 100 $default_Unit = '%';
117 101
118 102 if ( ! empty( $attributes['color'] ) ) {
119 - $css['--ablocks-divider-pattern-color'] = $divider_color;
103 + $css['--ablocks-divider-pattern-color'] = Color::get_css( isset( $attributes['color'] ) ? $attributes['color'] : '#000000' );
120 104 }
121 105
122 106 $moreRangeCSS = [];
123 107 if ( isset( $attributes['dividerType'] ) && $attributes['dividerType'] === 'mask-style' && isset( $attributes['size'] ) && ! empty( $attributes['size'] ) ) {
@@ -155,9 +139,9 @@
155 139 Range::get_css([
156 140 'attributeValue' => $attributes['width'],
157 141 'attribute_object_key' => 'value',
158 142 'isResponsive' => true,
159 - 'defaultValue' => null,
143 + 'defaultValue' => 100,
160 144 'hasUnit' => false,
161 145 'unitDefaultValue' => '%',
162 146 'property' => 'width',
163 147 'device' => $device,