| 1 |
<?php |
| 2 |
/** |
| 3 |
* RadiusTheme Variation Swatches support. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Controllers\PluginsSupport; |
| 9 |
|
| 10 |
use RadiusTheme\SB\Traits\SingletonTrait; |
| 11 |
use RadiusTheme\SB\Helpers\Fns; |
| 12 |
|
| 13 |
// Do not allow directly accessing this file. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit( 'This script cannot be accessed directly.' ); |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Product Description class |
| 20 |
*/ |
| 21 |
class RtwpvsSupport { |
| 22 |
/** |
| 23 |
* SingletonTrait. |
| 24 |
*/ |
| 25 |
use SingletonTrait; |
| 26 |
|
| 27 |
/** |
| 28 |
* Construct function |
| 29 |
*/ |
| 30 |
private function __construct() { |
| 31 |
add_filter( 'rtsb/elements/elementor/visibility_control', [ $this, 'general_content_visibility' ] ); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Content Visibility |
| 36 |
* |
| 37 |
* @param array $fields Fields. |
| 38 |
* |
| 39 |
* @return array |
| 40 |
*/ |
| 41 |
public function general_content_visibility( $fields ) { |
| 42 |
$extra_controls['show_swatches'] = [ |
| 43 |
'type' => 'switch', |
| 44 |
'label' => esc_html__( 'Show Variation Swatches?', 'shopbuilder' ), |
| 45 |
'description' => esc_html__( 'Switch on to show variation swatches.', 'shopbuilder' ), |
| 46 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 47 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 48 |
'default' => 'yes', |
| 49 |
'condition' => [ 'layout!' => [ 'grid-layout2', 'slider-layout2' ] ], |
| 50 |
]; |
| 51 |
|
| 52 |
$extra_controls['show_vs_clear_btn'] = [ |
| 53 |
'type' => 'switch', |
| 54 |
'label' => esc_html__( 'Show Swatches Reset?', 'shopbuilder' ), |
| 55 |
'description' => esc_html__( 'Switch on to show swatches clear button.', 'shopbuilder' ), |
| 56 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 57 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 58 |
'separator' => 'default', |
| 59 |
'condition' => [ |
| 60 |
'show_swatches' => [ 'yes' ], |
| 61 |
'layout!' => [ 'grid-layout2', 'slider-layout2' ], |
| 62 |
], |
| 63 |
]; |
| 64 |
|
| 65 |
return Fns::insert_controls( 'single_category', $fields, $extra_controls, true ); |
| 66 |
} |
| 67 |
} |
| 68 |
|