← All changes
|
includes/blocks/storeengine-shipping-info/block.php
+11
-13
2.8.1
→
2.14.0
View file →
| @@ -32,9 +32,10 @@ | ||
| 32 | 32 | $css_generator->add_class_styles( |
| 33 | 33 | '{{WRAPPER}} .storeengine-order-shipping-shortcode .storeengine-order-shipping-heading', |
| 34 | 34 | $this->get_shipping_heading_css( $attributes, '' ), |
| 35 | 35 | $this->get_shipping_heading_css( $attributes, 'Tablet' ), |
| 36 | - $this->get_shipping_heading_css( $attributes, 'Mobile' ) | |
| 36 | + $this->get_shipping_heading_css( $attributes, 'Mobile' ), | |
| 37 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_shipping_heading_css( $attributes, $device ); } ) | |
| 37 | 38 | ); |
| 38 | 39 | |
| 39 | 40 | $css_generator->add_class_styles( |
| 40 | 41 | '{{WRAPPER}} .storeengine-order-shipping-shortcode .storeengine-order-shipping-heading:hover', |
| @@ -39,15 +40,17 @@ | ||
| 39 | 40 | $css_generator->add_class_styles( |
| 40 | 41 | '{{WRAPPER}} .storeengine-order-shipping-shortcode .storeengine-order-shipping-heading:hover', |
| 41 | 42 | $this->get_shipping_heading_hover_css( $attributes, '' ), |
| 42 | 43 | $this->get_shipping_heading_hover_css( $attributes, 'Tablet' ), |
| 43 | - $this->get_shipping_heading_hover_css( $attributes, 'Mobile' ) | |
| 44 | + $this->get_shipping_heading_hover_css( $attributes, 'Mobile' ), | |
| 45 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_shipping_heading_hover_css( $attributes, $device ); } ) | |
| 44 | 46 | ); |
| 45 | 47 | $css_generator->add_class_styles( |
| 46 | 48 | '{{WRAPPER}} .storeengine-order-shipping-shortcode .storeengine-order-shipping-address p', |
| 47 | 49 | $this->get_shipping_address_css( $attributes, '' ), |
| 48 | 50 | $this->get_shipping_address_css( $attributes, 'Tablet' ), |
| 49 | - $this->get_shipping_address_css( $attributes, 'Mobile' ) | |
| 51 | + $this->get_shipping_address_css( $attributes, 'Mobile' ), | |
| 52 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_shipping_address_css( $attributes, $device ); } ) | |
| 50 | 53 | ); |
| 51 | 54 | |
| 52 | 55 | $css_generator->add_class_styles( |
| 53 | 56 | '{{WRAPPER}} .storeengine-order-shipping-shortcode .storeengine-order-shipping-address p:hover', |
| @@ -52,9 +55,10 @@ | ||
| 52 | 55 | $css_generator->add_class_styles( |
| 53 | 56 | '{{WRAPPER}} .storeengine-order-shipping-shortcode .storeengine-order-shipping-address p:hover', |
| 54 | 57 | $this->get_shipping_address_hover_css( $attributes, '' ), |
| 55 | 58 | $this->get_shipping_address_hover_css( $attributes, 'Tablet' ), |
| 56 | - $this->get_shipping_address_hover_css( $attributes, 'Mobile' ) | |
| 59 | + $this->get_shipping_address_hover_css( $attributes, 'Mobile' ), | |
| 60 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_shipping_address_hover_css( $attributes, $device ); } ) | |
| 57 | 61 | ); |
| 58 | 62 | |
| 59 | 63 | return $css_generator->generate_css(); |
| 60 | 64 | } |
| @@ -99,16 +103,10 @@ | ||
| 99 | 103 | return [ 'color' => Color::get_css( isset( $attributes['shipping_address_hover_color'] ) ? $attributes['shipping_address_hover_color'] : '' ) ]; |
| 100 | 104 | } |
| 101 | 105 | |
| 102 | 106 | public function render_block_content( $attributes, $content, $block_instance ) { |
| 103 | - $attr_array = []; | |
| 104 | - | |
| 105 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 106 | - if ( isset( $_GET['context'] ) && 'edit' === sanitize_text_field( $_GET['context'] ) ) { | |
| 107 | - $attr_array['dummy'] = true; | |
| 108 | - } | |
| 109 | - | |
| 110 | - $shortcode = '[storeengine_order_shipping_address ' . Helper::attr_shortcode( $attr_array ) . ']'; | |
| 111 | - echo do_shortcode( $shortcode ); | |
| 107 | + // StoreEngine core falls back to sample content when there's no real | |
| 108 | + // order (e.g. in the editor), so no dummy flag is needed here. | |
| 109 | + echo do_shortcode( '[storeengine_order_shipping_address]' ); | |
| 112 | 110 | } |
| 113 | 111 | |
| 114 | 112 | } |