| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main ProductDescription class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\Controls; |
| 9 |
|
| 10 |
use RadiusTheme\SB\Elementor\Helper\ControlHelper; |
| 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 ShippingMethodSettings { |
| 22 |
|
| 23 |
/** |
| 24 |
* Widget Control Selectors |
| 25 |
* |
| 26 |
* @var object |
| 27 |
*/ |
| 28 |
private static $widget = []; |
| 29 |
/** |
| 30 |
* Widget Control Selectors |
| 31 |
* |
| 32 |
* @var array |
| 33 |
*/ |
| 34 |
private static $selectors = []; |
| 35 |
|
| 36 |
/** |
| 37 |
* Widget Field |
| 38 |
* |
| 39 |
* @return array |
| 40 |
*/ |
| 41 |
public static function widget_fields( $widget ) { |
| 42 |
self::$widget = $widget; |
| 43 |
self::$selectors = $widget->selectors; |
| 44 |
return self::title_settings() + |
| 45 |
self::general_style_settings( self::$widget ) + |
| 46 |
TitleSettings::title_settings( self::$widget ) + |
| 47 |
self::label_settings( $widget ); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Widget Field |
| 52 |
* |
| 53 |
* @return array |
| 54 |
*/ |
| 55 |
public static function title_settings() { |
| 56 |
$title_settings = TitleSettings::general_settings(); |
| 57 |
|
| 58 |
$title_settings['general_style']['label'] = esc_html__( 'General', 'shopbuilder' ); |
| 59 |
|
| 60 |
$new_fields = [ |
| 61 |
'title_html_tag' => [ |
| 62 |
'label' => esc_html__( 'Title HTML Tag', 'shopbuilder' ), |
| 63 |
'type' => 'select', |
| 64 |
'options' => ControlHelper::heading_tags(), |
| 65 |
'default' => 'h2', |
| 66 |
'condition' => [ |
| 67 |
'show_title!' => '', |
| 68 |
], |
| 69 |
], |
| 70 |
'title_text' => [ |
| 71 |
'label' => esc_html__( 'Title Text', 'shopbuilder' ), |
| 72 |
'type' => 'text', |
| 73 |
'default' => esc_html__( 'Shipping', 'shopbuilder' ), |
| 74 |
'condition' => [ |
| 75 |
'show_title!' => '', |
| 76 |
], |
| 77 |
], |
| 78 |
]; |
| 79 |
|
| 80 |
$fields = Fns::insert_controls( 'show_title', $title_settings, $new_fields, true ); |
| 81 |
|
| 82 |
return $fields; |
| 83 |
} |
| 84 |
|
| 85 |
public static function general_style_settings( $widget ) { |
| 86 |
return [ |
| 87 |
'general_table_style_start' => [ |
| 88 |
'mode' => 'section_start', |
| 89 |
'tab' => 'style', |
| 90 |
'label' => esc_html__( 'General', 'shopbuilder' ), |
| 91 |
], |
| 92 |
'general_cart_table_border' => [ |
| 93 |
'mode' => 'group', |
| 94 |
'type' => 'border', |
| 95 |
'separator' => 'default', |
| 96 |
'label' => esc_html__( 'Border', 'shopbuilder' ), |
| 97 |
'selector' => $widget->selectors['general_cart_table_border'], |
| 98 |
'size_units' => [ 'px' ], |
| 99 |
], |
| 100 |
'general_cart_table_bg' => [ |
| 101 |
'label' => esc_html__( 'Background', 'shopbuilder' ), |
| 102 |
'type' => 'color', |
| 103 |
'selectors' => [ |
| 104 |
self::$selectors['general_cart_table_bg'] => 'background-color: {{VALUE}} !important;', |
| 105 |
], |
| 106 |
], |
| 107 |
'general_table_padding' => [ |
| 108 |
'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), |
| 109 |
'type' => 'dimensions', |
| 110 |
'mode' => 'responsive', |
| 111 |
'size_units' => [ 'px' ], |
| 112 |
'selectors' => [ |
| 113 |
$widget->selectors['general_table_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 114 |
], |
| 115 |
], |
| 116 |
'general_table_style_end' => [ |
| 117 |
'mode' => 'section_end', |
| 118 |
], |
| 119 |
]; |
| 120 |
} |
| 121 |
public static function label_settings( $widget ) { |
| 122 |
return [ |
| 123 |
'label_title_style_start' => [ |
| 124 |
'mode' => 'section_start', |
| 125 |
'tab' => 'style', |
| 126 |
'label' => esc_html__( 'Label', 'shopbuilder' ), |
| 127 |
'condition' => [ |
| 128 |
'show_title!' => '', |
| 129 |
], |
| 130 |
], |
| 131 |
'label_title_typo' => [ |
| 132 |
'mode' => 'group', |
| 133 |
'type' => 'typography', |
| 134 |
'label' => esc_html__( 'Typography', 'shopbuilder' ), |
| 135 |
'selector' => $widget->selectors['label_title_typo'], |
| 136 |
], |
| 137 |
'label_title_color' => [ |
| 138 |
'label' => esc_html__( 'Label Color', 'shopbuilder' ), |
| 139 |
'type' => 'color', |
| 140 |
'selectors' => [ |
| 141 |
$widget->selectors['label_title_color'] => 'color: {{VALUE}} !important;', |
| 142 |
], |
| 143 |
], |
| 144 |
'label_space_between' => [ |
| 145 |
'label' => esc_html__( 'Space Between (px)', 'shopbuilder' ), |
| 146 |
'type' => 'slider', |
| 147 |
'size_units' => [ 'px' ], |
| 148 |
'default' => [ |
| 149 |
'size' => 4, |
| 150 |
'unit' => 'px', |
| 151 |
], |
| 152 |
'range' => [ |
| 153 |
'px' => [ |
| 154 |
'min' => 0, |
| 155 |
'max' => 100, |
| 156 |
], |
| 157 |
], |
| 158 |
'selectors' => [ |
| 159 |
$widget->selectors['label_space_between'] => 'gap: {{SIZE}}{{UNIT}};', |
| 160 |
], |
| 161 |
], |
| 162 |
'label_item_space' => [ |
| 163 |
'label' => esc_html__( 'Label Gap (px)', 'shopbuilder' ), |
| 164 |
'type' => 'slider', |
| 165 |
'size_units' => [ 'px' ], |
| 166 |
'default' => [ |
| 167 |
'size' => 5, |
| 168 |
'unit' => 'px', |
| 169 |
], |
| 170 |
'range' => [ |
| 171 |
'px' => [ |
| 172 |
'min' => 0, |
| 173 |
'max' => 100, |
| 174 |
], |
| 175 |
], |
| 176 |
'selectors' => [ |
| 177 |
$widget->selectors['label_item_space'] => 'gap: {{SIZE}}{{UNIT}};', |
| 178 |
], |
| 179 |
], |
| 180 |
'label_title_style_end' => [ |
| 181 |
'mode' => 'section_end', |
| 182 |
], |
| 183 |
]; |
| 184 |
} |
| 185 |
} |
| 186 |
|