@@ -163,7 +163,16 @@ public function __construct() {
163
163
add_action ( 'botiga_before_render_single_product_elements ' , array ( $ this , 'turn_on_merchant_modules_shortcode_functionality ' ) );
164
164
165
165
// Some modules like the 'reasons-to-buy' are initialized in the 'wp' hook. So we have to rely on this hook to force the activation from the shortcode mode.
166
- add_action ( 'wp ' , array ( $ this , 'turn_on_merchant_modules_shortcode_functionality_to_specific_modules ' ) );
166
+ add_action ( 'wp ' , array ( $ this , 'turn_on_merchant_modules_shortcode_functionality_on_wp_hook ' ) );
167
+ }
168
+
169
+ /**
170
+ * Get the single product gallery layout (from customizer).
171
+ *
172
+ * @return string
173
+ */
174
+ public function get_single_product_gallery_layout () {
175
+ return get_theme_mod ( 'single_product_gallery ' , 'gallery-default ' );
167
176
}
168
177
169
178
/**
@@ -173,6 +182,10 @@ public function __construct() {
173
182
*/
174
183
public function turn_on_merchant_modules_shortcode_functionality () {
175
184
foreach ( self ::$ modules_data as $ module_id => $ module ) {
185
+ if ( 'gallery-full-width ' === $ this ->get_single_product_gallery_layout () ) {
186
+ continue ;
187
+ }
188
+
176
189
add_filter ( "merchant_ {$ module_id }_is_shortcode_enabled " , '__return_true ' );
177
190
}
178
191
}
@@ -182,12 +195,16 @@ public function turn_on_merchant_modules_shortcode_functionality() {
182
195
*
183
196
* @return void
184
197
*/
185
- public function turn_on_merchant_modules_shortcode_functionality_to_specific_modules () {
198
+ public function turn_on_merchant_modules_shortcode_functionality_on_wp_hook () {
186
199
foreach ( self ::$ modules_data as $ module_id => $ module ) {
187
200
if ( ! in_array ( $ module_id , array ( 'reasons-to-buy ' ), true ) ) {
188
201
continue ;
189
202
}
190
203
204
+ if ( 'gallery-full-width ' === $ this ->get_single_product_gallery_layout () ) {
205
+ continue ;
206
+ }
207
+
191
208
add_filter ( "merchant_ {$ module_id }_is_shortcode_enabled " , '__return_true ' );
192
209
}
193
210
}
@@ -282,6 +299,10 @@ public function admin_field_wrapper_class( $classes, $settings, $value, $module_
282
299
return $ classes ;
283
300
}
284
301
302
+ if ( 'gallery-full-width ' === $ this ->get_single_product_gallery_layout () ) {
303
+ return $ classes ;
304
+ }
305
+
285
306
$ descriptions_map = self ::get_module_admin_field_descriptions ();
286
307
if ( ! array_key_exists ( $ module_id , $ descriptions_map ) || ! array_key_exists ( $ settings ['id ' ], $ descriptions_map [ $ module_id ] ) ) {
287
308
return $ classes ;
@@ -306,6 +327,10 @@ public function replace_module_field_description( $desc, $settings, $value, $mod
306
327
return $ desc ;
307
328
}
308
329
330
+ if ( 'gallery-full-width ' === $ this ->get_single_product_gallery_layout () ) {
331
+ return $ desc ;
332
+ }
333
+
309
334
$ descriptions_map = self ::get_module_admin_field_descriptions ();
310
335
if ( ! array_key_exists ( $ module_id , $ descriptions_map ) || ! array_key_exists ( $ settings ['id ' ], $ descriptions_map [ $ module_id ] ) ) {
311
336
return $ desc ;
0 commit comments