← All changes
|
includes/blocks/storeengine-order-details/block.php
+29
-24
2.9.0
→
2.14.0
View file →
| @@ -33,9 +33,10 @@ | ||
| 33 | 33 | $css_generator->add_class_styles( |
| 34 | 34 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title p', |
| 35 | 35 | $this->get_order_details_css( $attributes ), |
| 36 | 36 | $this->get_order_details_css( $attributes, 'Tablet' ), |
| 37 | - $this->get_order_details_css( $attributes, 'Mobile' ) | |
| 37 | + $this->get_order_details_css( $attributes, 'Mobile' ), | |
| 38 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_css( $attributes, $device ); } ) | |
| 38 | 39 | ); |
| 39 | 40 | |
| 40 | 41 | $css_generator->add_class_styles( |
| 41 | 42 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title p:hover', |
| @@ -40,27 +41,31 @@ | ||
| 40 | 41 | $css_generator->add_class_styles( |
| 41 | 42 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title p:hover', |
| 42 | 43 | $this->get_order_details_hover_css( $attributes ), |
| 43 | 44 | $this->get_order_details_hover_css( $attributes, 'Tablet' ), |
| 44 | - $this->get_order_details_hover_css( $attributes, 'Mobile' ) | |
| 45 | + $this->get_order_details_hover_css( $attributes, 'Mobile' ), | |
| 46 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_hover_css( $attributes, $device ); } ) | |
| 45 | 47 | ); |
| 46 | 48 | $css_generator->add_class_styles( |
| 47 | 49 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content img', |
| 48 | 50 | $this->get_order_details_image_css( $attributes ), |
| 49 | 51 | $this->get_order_details_image_css( $attributes, 'Tablet' ), |
| 50 | - $this->get_order_details_image_css( $attributes, 'Mobile' ) | |
| 52 | + $this->get_order_details_image_css( $attributes, 'Mobile' ), | |
| 53 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_image_css( $attributes, $device ); } ) | |
| 51 | 54 | ); |
| 52 | 55 | $css_generator->add_class_styles( |
| 53 | 56 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title h6 a', |
| 54 | 57 | $this->get_order_details_product_title_css( $attributes ), |
| 55 | 58 | $this->get_order_details_product_title_css( $attributes, 'Tablet' ), |
| 56 | - $this->get_order_details_product_title_css( $attributes, 'Mobile' ) | |
| 59 | + $this->get_order_details_product_title_css( $attributes, 'Mobile' ), | |
| 60 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_product_title_css( $attributes, $device ); } ) | |
| 57 | 61 | ); |
| 58 | 62 | $css_generator->add_class_styles( |
| 59 | 63 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title h6 a:hover', |
| 60 | 64 | $this->get_order_details_product_title_hover_css( $attributes ), |
| 61 | 65 | $this->get_order_details_product_title_hover_css( $attributes, 'Tablet' ), |
| 62 | - $this->get_order_details_product_title_hover_css( $attributes, 'Mobile' ) | |
| 66 | + $this->get_order_details_product_title_hover_css( $attributes, 'Mobile' ), | |
| 67 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_product_title_hover_css( $attributes, $device ); } ) | |
| 63 | 68 | ); |
| 64 | 69 | |
| 65 | 70 | $css_generator->add_class_styles( |
| 66 | 71 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__price', |
| @@ -65,27 +70,31 @@ | ||
| 65 | 70 | $css_generator->add_class_styles( |
| 66 | 71 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__price', |
| 67 | 72 | $this->get_order_details_price_css( $attributes ), |
| 68 | 73 | $this->get_order_details_price_css( $attributes, 'Tablet' ), |
| 69 | - $this->get_order_details_price_css( $attributes, 'Mobile' ) | |
| 74 | + $this->get_order_details_price_css( $attributes, 'Mobile' ), | |
| 75 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_price_css( $attributes, $device ); } ) | |
| 70 | 76 | ); |
| 71 | 77 | $css_generator->add_class_styles( |
| 72 | 78 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__price:hover', |
| 73 | 79 | $this->get_order_details_price_hover_css( $attributes ), |
| 74 | 80 | $this->get_order_details_price_hover_css( $attributes, 'Tablet' ), |
| 75 | - $this->get_order_details_price_hover_css( $attributes, 'Mobile' ) | |
| 81 | + $this->get_order_details_price_hover_css( $attributes, 'Mobile' ), | |
| 82 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_price_hover_css( $attributes, $device ); } ) | |
| 76 | 83 | ); |
| 77 | 84 | $css_generator->add_class_styles( |
| 78 | 85 | '{{WRAPPER}} .storeengine-order-summary-shortcode .storeengine-order-summary__item .storeengine-order-item-entry-right .storeengine-order-item__price .storeengine-order-item__price-regular', |
| 79 | 86 | $this->get_order_details_regular_price_css( $attributes ), |
| 80 | 87 | $this->get_order_details_regular_price_css( $attributes, 'Tablet' ), |
| 81 | - $this->get_order_details_regular_price_css( $attributes, 'Mobile' ) | |
| 88 | + $this->get_order_details_regular_price_css( $attributes, 'Mobile' ), | |
| 89 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_regular_price_css( $attributes, $device ); } ) | |
| 82 | 90 | ); |
| 83 | 91 | $css_generator->add_class_styles( |
| 84 | 92 | '{{WRAPPER}} .storeengine-order-summary-shortcode .storeengine-order-summary__item .storeengine-order-item-entry-right .storeengine-order-item__price .storeengine-order-item__price-regular:hover', |
| 85 | 93 | $this->get_order_details_price_regular_hover_css( $attributes ), |
| 86 | 94 | $this->get_order_details_price_regular_hover_css( $attributes, 'Tablet' ), |
| 87 | - $this->get_order_details_price_regular_hover_css( $attributes, 'Mobile' ) | |
| 95 | + $this->get_order_details_price_regular_hover_css( $attributes, 'Mobile' ), | |
| 96 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_price_regular_hover_css( $attributes, $device ); } ) | |
| 88 | 97 | ); |
| 89 | 98 | $css_generator->add_class_styles( |
| 90 | 99 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title p, |
| 91 | 100 | {{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title p span', |
| @@ -90,9 +99,10 @@ | ||
| 90 | 99 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title p, |
| 91 | 100 | {{WRAPPER}} .storeengine-order-details-shortcode .storeengine-order-item__content .storeengine-order-item__title p span', |
| 92 | 101 | $this->get_order_details_quality_css( $attributes ), |
| 93 | 102 | $this->get_order_details_quality_css( $attributes, 'Tablet' ), |
| 94 | - $this->get_order_details_quality_css( $attributes, 'Mobile' ) | |
| 103 | + $this->get_order_details_quality_css( $attributes, 'Mobile' ), | |
| 104 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_quality_css( $attributes, $device ); } ) | |
| 95 | 105 | ); |
| 96 | 106 | $css_generator->add_class_styles( |
| 97 | 107 | '{{WRAPPER}} .storeengine-order-summary-shortcode .storeengine-order-summary__item .storeengine-order-item-entry-right .storeengine-order-item__qty:hover, |
| 98 | 108 | {{WRAPPER}} .storeengine-order-summary-shortcode .storeengine-order-summary__item .storeengine-order-item-entry-right .storeengine-order-item__qty span:hover', |
| @@ -97,9 +107,10 @@ | ||
| 97 | 107 | '{{WRAPPER}} .storeengine-order-summary-shortcode .storeengine-order-summary__item .storeengine-order-item-entry-right .storeengine-order-item__qty:hover, |
| 98 | 108 | {{WRAPPER}} .storeengine-order-summary-shortcode .storeengine-order-summary__item .storeengine-order-item-entry-right .storeengine-order-item__qty span:hover', |
| 99 | 109 | $this->get_order_details_quality_hover_css( $attributes ), |
| 100 | 110 | $this->get_order_details_quality_hover_css( $attributes, 'Tablet' ), |
| 101 | - $this->get_order_details_quality_hover_css( $attributes, 'Mobile' ) | |
| 111 | + $this->get_order_details_quality_hover_css( $attributes, 'Mobile' ), | |
| 112 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_order_details_quality_hover_css( $attributes, $device ); } ) | |
| 102 | 113 | ); |
| 103 | 114 | $css_generator->add_class_styles( |
| 104 | 115 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p, |
| 105 | 116 | {{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p span', |
| @@ -104,9 +115,10 @@ | ||
| 104 | 115 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p, |
| 105 | 116 | {{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p span', |
| 106 | 117 | $this->get_table_text_css( $attributes ), |
| 107 | 118 | $this->get_table_text_css( $attributes, 'Tablet' ), |
| 108 | - $this->get_table_text_css( $attributes, 'Mobile' ) | |
| 119 | + $this->get_table_text_css( $attributes, 'Mobile' ), | |
| 120 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_table_text_css( $attributes, $device ); } ) | |
| 109 | 121 | ); |
| 110 | 122 | $css_generator->add_class_styles( |
| 111 | 123 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p:hover, |
| 112 | 124 | {{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p span:hover', |
| @@ -111,9 +123,10 @@ | ||
| 111 | 123 | '{{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p:hover, |
| 112 | 124 | {{WRAPPER}} .storeengine-order-details-shortcode .storeengine-thankyou-summery--item p span:hover', |
| 113 | 125 | $this->get_table_text_hover_css( $attributes ), |
| 114 | 126 | $this->get_table_text_hover_css( $attributes, 'Tablet' ), |
| 115 | - $this->get_table_text_hover_css( $attributes, 'Mobile' ) | |
| 127 | + $this->get_table_text_hover_css( $attributes, 'Mobile' ), | |
| 128 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_table_text_hover_css( $attributes, $device ); } ) | |
| 116 | 129 | ); |
| 117 | 130 | |
| 118 | 131 | return $css_generator->generate_css(); |
| 119 | 132 | } |
| @@ -240,18 +253,10 @@ | ||
| 240 | 253 | } |
| 241 | 254 | |
| 242 | 255 | |
| 243 | 256 | public function render_block_content( $attributes, $content, $block_instance ) { |
| 244 | - $attr_array = [ | |
| 245 | - // 'ids' => Helper::get_attribute_value( $attributes, 'products_ids' ), | |
| 246 | - ]; | |
| 247 | - | |
| 248 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 249 | - if ( isset( $_GET['context'] ) && 'edit' === sanitize_text_field( $_GET['context'] ) ) { | |
| 250 | - $attr_array['dummy'] = true; | |
| 251 | - } | |
| 252 | - | |
| 253 | - $shortcode = '[storeengine_order_details ' . Helper::attr_shortcode( $attr_array ) . ']'; | |
| 254 | - echo do_shortcode( $shortcode ); | |
| 257 | + // StoreEngine core falls back to sample content when there's no real | |
| 258 | + // order (e.g. in the editor), so no dummy flag is needed here. | |
| 259 | + echo do_shortcode( '[storeengine_order_details]' ); | |
| 255 | 260 | } |
| 256 | 261 | } |
| 257 | 262 | |