| @@ -23,13 +23,8 @@ | ||
| 23 | 23 | * ProductsGrid class. |
| 24 | 24 | */ |
| 25 | 25 | abstract class AdditionalQueryCustomLayout extends ElementorWidgetBase { |
| 26 | 26 | /** |
| 27 | - * Control Fields | |
| 28 | - * | |
| 29 | - * @var array | |
| 30 | - */ | |
| 31 | - /** | |
| 32 | 27 | * Action Button Traits. |
| 33 | 28 | */ |
| 34 | 29 | use ActionBtnTraits; |
| 35 | 30 | |
| @@ -82,10 +77,8 @@ | ||
| 82 | 77 | $this->widget_query() |
| 83 | 78 | ) |
| 84 | 79 | ); |
| 85 | 80 | |
| 86 | - unset( $fields['grid_style'] ); | |
| 87 | - | |
| 88 | 81 | return $fields; |
| 89 | 82 | } |
| 90 | 83 | |
| 91 | 84 | /** |
| @@ -110,15 +103,16 @@ | ||
| 110 | 103 | unset( $content_visibility['show_title']['separator'] ); |
| 111 | 104 | |
| 112 | 105 | $sections = array_merge( |
| 113 | 106 | $content_visibility, |
| 107 | + Controls\SettingsFields::content_ordering( $this ), | |
| 108 | + Controls\SettingsFields::section_title( $this ), | |
| 114 | 109 | Controls\SettingsFields::image( $this ), |
| 115 | 110 | Controls\SettingsFields::action_buttons( $this ), |
| 116 | - Controls\SettingsFields::section_title( $this ), | |
| 117 | 111 | Controls\SettingsFields::product_title( $this ), |
| 118 | 112 | Controls\SettingsFields::product_excerpt( $this ), |
| 119 | 113 | Controls\SettingsFields::badges( $this ), |
| 120 | - Controls\SettingsFields::variation_swatch( $this ), | |
| 114 | + $this->variation_swatch_conditionaly(), | |
| 121 | 115 | Controls\SettingsFields::links( $this ) |
| 122 | 116 | ); |
| 123 | 117 | return apply_filters( 'rtsb/elements/elementor/product_custom_settings_tab', $sections, $this ); |
| 124 | 118 | } |
| @@ -129,13 +123,31 @@ | ||
| 129 | 123 | */ |
| 130 | 124 | protected function widget_layout() { |
| 131 | 125 | return Controls\LayoutFields::grid_layout( $this ); |
| 132 | 126 | } |
| 127 | + | |
| 133 | 128 | /** |
| 134 | 129 | * Controls for layout tab |
| 135 | 130 | * |
| 136 | 131 | * @return array |
| 137 | 132 | */ |
| 133 | + public function variation_swatch_conditionaly() { | |
| 134 | + if ( ! function_exists( 'rtwpvsp' ) && ! rtsb()->has_pro() ) { | |
| 135 | + return []; | |
| 136 | + } | |
| 137 | + $swatches_controls = Controls\SettingsFields::variation_swatch( $this ); | |
| 138 | + if ( ! empty( $swatches_controls['swatch_position'] ) ) { | |
| 139 | + $swatches_controls['swatch_position']['condition'] = [ | |
| 140 | + 'layout' => [ 'grid-layout1' ], | |
| 141 | + ]; | |
| 142 | + } | |
| 143 | + return $swatches_controls; | |
| 144 | + } | |
| 145 | + /** | |
| 146 | + * Controls for layout tab | |
| 147 | + * | |
| 148 | + * @return array | |
| 149 | + */ | |
| 138 | 150 | protected function widget_query() { |
| 139 | 151 | $additional_query = Controls\LayoutFields::additional_query( $this ); |
| 140 | 152 | $additional_query['posts_limit']['separator'] = 'default'; |
| 141 | 153 | return $additional_query; |
| @@ -140,8 +152,13 @@ | ||
| 140 | 152 | $additional_query['posts_limit']['separator'] = 'default'; |
| 141 | 153 | return $additional_query; |
| 142 | 154 | } |
| 143 | 155 | |
| 156 | + /** | |
| 157 | + * Controls for style tab | |
| 158 | + * | |
| 159 | + * @return array | |
| 160 | + */ | |
| 144 | 161 | protected function pagination_navigation() { |
| 145 | 162 | return Controls\StyleFields::pagination( $this ); |
| 146 | 163 | } |
| 147 | 164 | |
| @@ -166,8 +183,9 @@ | ||
| 166 | 183 | Controls\StyleFields::product_add_to_cart( $this ), |
| 167 | 184 | Controls\StyleFields::product_wishlist( $this ), |
| 168 | 185 | Controls\StyleFields::product_quick_view( $this ), |
| 169 | 186 | Controls\StyleFields::product_compare( $this ), |
| 187 | + Controls\StyleFields::action_buttons( $this ), | |
| 170 | 188 | Controls\StyleFields::product_badges( $this ), |
| 171 | 189 | $this->pagination_navigation(), |
| 172 | 190 | Controls\StyleFields::hover_icon_button( $this ) |
| 173 | 191 | ), |
| @@ -177,9 +195,9 @@ | ||
| 177 | 195 | |
| 178 | 196 | /** |
| 179 | 197 | * Widget Field |
| 180 | 198 | * |
| 181 | - * @return void|array | |
| 199 | + * @return string | |
| 182 | 200 | */ |
| 183 | 201 | protected function render_template_file() { |
| 184 | 202 | return 'elementor/general/grid/'; |
| 185 | 203 | } |
| @@ -196,9 +214,9 @@ | ||
| 196 | 214 | $this->render_start(); |
| 197 | 215 | $args = [ |
| 198 | 216 | 'posts_per_page' => $settings['posts_limit'], |
| 199 | 217 | 'columns' => $settings['posts_limit'], |
| 200 | - 'orderby' => $settings['posts_order_by'], // @codingStandardsIgnoreLine. | |
| 218 | + 'orderby' => $settings['posts_order_by'], | |
| 201 | 219 | 'order' => $settings['posts_order'], |
| 202 | 220 | ]; |
| 203 | 221 | |
| 204 | 222 | $settings['query_products'] = $this->get_the_products( $args ); |
| @@ -210,11 +228,11 @@ | ||
| 210 | 228 | if ( $this->is_builder_mode() ) { |
| 211 | 229 | add_filter( 'wp_kses_allowed_html', [ FilterHooks::class, 'custom_wpkses_post_tags' ], 10, 2 ); |
| 212 | 230 | } |
| 213 | 231 | |
| 232 | + // Call the template rendering method. | |
| 214 | 233 | Fns::print_html( Render::instance()->setup_loop_for_product_view( $this->render_template_file(), $settings, $this ), true ); |
| 215 | 234 | |
| 216 | 235 | $this->action_button_icon_set_default(); |
| 217 | 236 | $this->render_end(); |
| 218 | 237 | } |
| 219 | - | |
| 220 | 238 | } |