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/image-hotspot-child/block.php +12 -10 2.9.1 → 2.14.0 View file →
@@ -1,12 +1,18 @@
1 1 <?php
2 2 namespace ABlocks\Blocks\ImageHotspotChild;
3 3
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
7 +
8 +
4 9 use ABlocks\Controls\Border;
5 10 use ABlocks\Controls\Dimensions;
6 11 use ABlocks\Controls\Range;
7 12 use ABlocks\Classes\BlockBaseAbstract;
8 13 use ABlocks\Classes\CssGenerator;
14 +use ABlocks\Controls\Color;
9 15
10 16 class Block extends BlockBaseAbstract {
11 17 protected $parent_block_name = 'image-hotspot';
12 18 protected $block_name = 'image-hotspot-child';
@@ -17,9 +23,10 @@
17 23 $css_generator->add_class_styles(
18 24 '{{WRAPPER}} .ablocks-image-hotspot__tooltip--active',
19 25 $this->get_active_content_css( $attributes ),
20 26 $this->get_active_content_css( $attributes, 'Tablet' ),
21 - $this->get_active_content_css( $attributes, 'Mobile' )
27 + $this->get_active_content_css( $attributes, 'Mobile' ),
28 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_active_content_css( $attributes, $device ); } )
22 29 );
23 30
24 31 $css_generator->add_class_styles(
25 32 '{{WRAPPER}} .ablocks-image-hotspot__tooltip--active:hover',
@@ -24,9 +31,10 @@
24 31 $css_generator->add_class_styles(
25 32 '{{WRAPPER}} .ablocks-image-hotspot__tooltip--active:hover',
26 33 $this->get_active_content_hover_css( $attributes ),
27 34 $this->get_active_content_hover_css( $attributes, 'Tablet' ),
28 - $this->get_active_content_hover_css( $attributes, 'Mobile' )
35 + $this->get_active_content_hover_css( $attributes, 'Mobile' ),
36 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_active_content_hover_css( $attributes, $device ); } )
29 37 );
30 38
31 39 return $css_generator->generate_css();
32 40 }
@@ -31,21 +39,15 @@
31 39 return $css_generator->generate_css();
32 40 }
33 41
34 42 public function get_active_content_css( $attributes, $device = '' ) {
35 - $css = array();
36 -
37 - // Set background color
38 - if ( ! empty( $attributes['backgroundColor'] ) ) {
39 - $css['background-color'] = $attributes['backgroundColor'];
40 - }
41 -
42 43 // Add border and padding styles
43 44 $border_css = isset( $attributes['contentBorder'] ) ? Border::get_css( $attributes['contentBorder'], '', $device ) : [];
44 45 $padding_css = isset( $attributes['contentPadding'] ) ? Dimensions::get_css( $attributes['contentPadding'], 'padding', $device ) : [];
45 46
46 47 // Merge border and padding styles with the main CSS
47 - $css = array_merge( $css, $border_css, $padding_css,
48 + $css = array_merge($border_css, $padding_css,
49 + [ 'background' => Color::get_css( isset( $attributes['backgroundColor'] ) ? $attributes['backgroundColor'] : '' ) ],
48 50 Range::get_css(
49 51 [
50 52 'attributeValue' => $attributes['contentWidth'],
51 53 'attribute_object_key' => 'value',