← All changes
|
includes/blocks/storeengine-billing-info/block.php
+11
-12
2.8.0
→
2.14.0
View file →
| @@ -31,27 +31,31 @@ | ||
| 31 | 31 | $css_generator->add_class_styles( |
| 32 | 32 | '{{WRAPPER}} .storeengine-order-billing-shortcode .storeengine-order-billing-heading', |
| 33 | 33 | $this->get_billing_heading_css( $attributes, '' ), |
| 34 | 34 | $this->get_billing_heading_css( $attributes, 'Tablet' ), |
| 35 | - $this->get_billing_heading_css( $attributes, 'Mobile' ) | |
| 35 | + $this->get_billing_heading_css( $attributes, 'Mobile' ), | |
| 36 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_billing_heading_css( $attributes, $device ); } ) | |
| 36 | 37 | ); |
| 37 | 38 | $css_generator->add_class_styles( |
| 38 | 39 | '{{WRAPPER}} .storeengine-order-billing-shortcode .storeengine-order-billing-heading:hover', |
| 39 | 40 | $this->get_billing_heading_hover_css( $attributes, '' ), |
| 40 | 41 | $this->get_billing_heading_hover_css( $attributes, 'Tablet' ), |
| 41 | - $this->get_billing_heading_hover_css( $attributes, 'Mobile' ) | |
| 42 | + $this->get_billing_heading_hover_css( $attributes, 'Mobile' ), | |
| 43 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_billing_heading_hover_css( $attributes, $device ); } ) | |
| 42 | 44 | ); |
| 43 | 45 | $css_generator->add_class_styles( |
| 44 | 46 | '{{WRAPPER}} .storeengine-order-billing-shortcode .storeengine-order-billing-address p', |
| 45 | 47 | $this->get_billing_address_css( $attributes, '' ), |
| 46 | 48 | $this->get_billing_address_css( $attributes, 'Tablet' ), |
| 47 | - $this->get_billing_address_css( $attributes, 'Mobile' ) | |
| 49 | + $this->get_billing_address_css( $attributes, 'Mobile' ), | |
| 50 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_billing_address_css( $attributes, $device ); } ) | |
| 48 | 51 | ); |
| 49 | 52 | $css_generator->add_class_styles( |
| 50 | 53 | '{{WRAPPER}} .storeengine-order-billing-shortcode .storeengine-order-billing-address p:hover', |
| 51 | 54 | $this->get_billing_address_hover_css( $attributes, '' ), |
| 52 | 55 | $this->get_billing_address_hover_css( $attributes, 'Tablet' ), |
| 53 | - $this->get_billing_address_hover_css( $attributes, 'Mobile' ) | |
| 56 | + $this->get_billing_address_hover_css( $attributes, 'Mobile' ), | |
| 57 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_billing_address_hover_css( $attributes, $device ); } ) | |
| 54 | 58 | ); |
| 55 | 59 | |
| 56 | 60 | return $css_generator->generate_css(); |
| 57 | 61 | } |
| @@ -93,15 +97,10 @@ | ||
| 93 | 97 | return [ 'color' => Color::get_css( isset( $attributes['address_hover_color'] ) ? $attributes['address_hover_color'] : '' ) ]; |
| 94 | 98 | } |
| 95 | 99 | |
| 96 | 100 | public function render_block_content( $attributes, $content, $block_instance ) { |
| 97 | - $attr_array = []; | |
| 98 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 99 | - if ( isset( $_GET['context'] ) && 'edit' === sanitize_text_field( $_GET['context'] ) ) { | |
| 100 | - $attr_array['dummy'] = true; | |
| 101 | - } | |
| 102 | - | |
| 103 | - $shortcode = '[storeengine_order_billing_address ' . Helper::attr_shortcode( $attr_array ) . ']'; | |
| 104 | - echo do_shortcode( $shortcode ); | |
| 101 | + // StoreEngine core falls back to sample content when there's no real | |
| 102 | + // order (e.g. in the editor), so no dummy flag is needed here. | |
| 103 | + echo do_shortcode( '[storeengine_order_billing_address]' ); | |
| 105 | 104 | } |
| 106 | 105 | |
| 107 | 106 | } |