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/chart/block.php +32 -3 2.9.1 → 2.14.0 View file →
@@ -9,20 +9,22 @@
9 9 }
10 10
11 11 use ABlocks\Classes\BlockBaseAbstract;
12 12 use ABlocks\Classes\CssGenerator;
13 +use ABlocks\Classes\CssGeneratorV2;
13 14 use ABlocks\Controls\Alignment;
14 15
15 16 class Block extends BlockBaseAbstract {
16 17 protected $block_name = 'chart';
17 18 protected $script_depends = [ 'ablocks-chart.js-script' ];
18 - public function build_css( $attributes ) {
19 + public function build_css_v1( $attributes ) {
19 20 $css_generator = new CssGenerator( $attributes, $this->block_name );
20 21 $css_generator->add_class_styles(
21 22 '{{WRAPPER}}',
22 23 $this->get_wrapper_css( $attributes ),
23 24 $this->get_wrapper_css( $attributes, 'Tablet' ),
24 - $this->get_wrapper_css( $attributes, 'Mobile' )
25 + $this->get_wrapper_css( $attributes, 'Mobile' ),
26 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_wrapper_css( $attributes, $device ); } )
25 27 );
26 28
27 29 $css_generator->add_class_styles(
28 30 '{{WRAPPER}} .ablocks-chart-canvas',
@@ -27,12 +29,39 @@
27 29 $css_generator->add_class_styles(
28 30 '{{WRAPPER}} .ablocks-chart-canvas',
29 31 $this->get_chart_css( $attributes ),
30 32 $this->get_chart_css( $attributes, 'Tablet' ),
31 - $this->get_chart_css( $attributes, 'Mobile' )
33 + $this->get_chart_css( $attributes, 'Mobile' ),
34 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_chart_css( $attributes, $device ); } )
32 35 );
33 36
34 37 return $css_generator->generate_css();
38 + }
39 + public function build_css_v2( $attributes ) {
40 + $css_generator = new CssGeneratorV2( $attributes, $this->block_name );
41 + $css_generator->add_class_styles(
42 + '{{WRAPPER}}',
43 + $this->get_wrapper_css( $attributes ),
44 + $this->get_wrapper_css( $attributes, 'Tablet' ),
45 + $this->get_wrapper_css( $attributes, 'Mobile' ),
46 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_wrapper_css( $attributes, $device ); } )
47 + );
48 +
49 + $css_generator->add_class_styles(
50 + '{{WRAPPER}} .ablocks-chart-canvas',
51 + $this->get_chart_css( $attributes ),
52 + $this->get_chart_css( $attributes, 'Tablet' ),
53 + $this->get_chart_css( $attributes, 'Mobile' ),
54 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_chart_css( $attributes, $device ); } )
55 + );
56 +
57 + return $css_generator->generate_css();
58 + }
59 + public function build_css( $attributes ) {
60 + if ( isset( $attributes['blockVersion'] ) && (int) $attributes['blockVersion'] === 2 ) {
61 + return $this->build_css_v2( $attributes );
62 + }
63 + return $this->build_css_v1( $attributes );
35 64 }
36 65
37 66 public function get_wrapper_css( $attributes, $device = '' ) {
38 67 return isset( $attributes['alignment'] ) ? Alignment::get_css( $attributes['alignment'], 'text-align', $device ) : [];