| @@ -1,7 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace ABlocks\Blocks\FlipBox; |
| 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\Background; |
| 7 | 11 | use ABlocks\Controls\Border; |
| @@ -11,8 +15,9 @@ | ||
| 11 | 15 | |
| 12 | 16 | class Block extends BlockBaseAbstract { |
| 13 | 17 | protected $block_name = 'flip-box'; |
| 14 | 18 | |
| 19 | + // No Dom optimization needed | |
| 15 | 20 | public function build_css( $attributes ) { |
| 16 | 21 | |
| 17 | 22 | // Generate CSS start |
| 18 | 23 | $css_generator = new CssGenerator( $attributes ); |
| @@ -25,9 +30,10 @@ | ||
| 25 | 30 | $css_generator->add_class_styles( |
| 26 | 31 | '{{WRAPPER}} .ablocks-flipbox__front > div:nth-child(1)', |
| 27 | 32 | $this->get_front_card_css( $attributes ), |
| 28 | 33 | $this->get_front_card_css( $attributes, 'Tablet' ), |
| 29 | - $this->get_front_card_css( $attributes, 'Mobile' ) | |
| 34 | + $this->get_front_card_css( $attributes, 'Mobile' ), | |
| 35 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_front_card_css( $attributes, $device ); } ) | |
| 30 | 36 | ); |
| 31 | 37 | |
| 32 | 38 | $css_generator->add_class_styles( |
| 33 | 39 | '{{WRAPPER}} .ablocks-flipbox__back > div:nth-child(1)', |
| @@ -32,9 +38,10 @@ | ||
| 32 | 38 | $css_generator->add_class_styles( |
| 33 | 39 | '{{WRAPPER}} .ablocks-flipbox__back > div:nth-child(1)', |
| 34 | 40 | $this->get_back_card_css( $attributes ), |
| 35 | 41 | $this->get_back_card_css( $attributes, 'Tablet' ), |
| 36 | - $this->get_back_card_css( $attributes, 'Mobile' ) | |
| 42 | + $this->get_back_card_css( $attributes, 'Mobile' ), | |
| 43 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_back_card_css( $attributes, $device ); } ) | |
| 37 | 44 | ); |
| 38 | 45 | |
| 39 | 46 | $css_generator->add_class_styles( |
| 40 | 47 | '{{WRAPPER}} .ablocks-flipbox__front:hover > div:nth-child(1)', |
| @@ -39,9 +46,10 @@ | ||
| 39 | 46 | $css_generator->add_class_styles( |
| 40 | 47 | '{{WRAPPER}} .ablocks-flipbox__front:hover > div:nth-child(1)', |
| 41 | 48 | $this->get_front_card_hover_css( $attributes ), |
| 42 | 49 | $this->get_front_card_hover_css( $attributes, 'Tablet' ), |
| 43 | - $this->get_front_card_hover_css( $attributes, 'Mobile' ) | |
| 50 | + $this->get_front_card_hover_css( $attributes, 'Mobile' ), | |
| 51 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_front_card_hover_css( $attributes, $device ); } ) | |
| 44 | 52 | ); |
| 45 | 53 | |
| 46 | 54 | $css_generator->add_class_styles( |
| 47 | 55 | '{{WRAPPER}} .ablocks-flipbox__back:hover > div:nth-child(1)', |
| @@ -46,9 +54,10 @@ | ||
| 46 | 54 | $css_generator->add_class_styles( |
| 47 | 55 | '{{WRAPPER}} .ablocks-flipbox__back:hover > div:nth-child(1)', |
| 48 | 56 | $this->get_back_card_hover_css( $attributes ), |
| 49 | 57 | $this->get_back_card_hover_css( $attributes, 'Tablet' ), |
| 50 | - $this->get_back_card_hover_css( $attributes, 'Mobile' ) | |
| 58 | + $this->get_back_card_hover_css( $attributes, 'Mobile' ), | |
| 59 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_back_card_hover_css( $attributes, $device ); } ) | |
| 51 | 60 | ); |
| 52 | 61 | |
| 53 | 62 | return $css_generator->generate_css(); |
| 54 | 63 | } |