| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main ProductDescription class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\Controls; |
| 9 |
|
| 10 |
use Elementor\Controls_Manager; |
| 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 CheckoutInfoBoxSettings |
| 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 |
* Controls Settings |
| 38 |
* |
| 39 |
* @param object $widget widget object. |
| 40 |
* @return array |
| 41 |
*/ |
| 42 |
public static function widget_fields($widget) |
| 43 |
{ |
| 44 |
self::$widget = $widget; |
| 45 |
self::$selectors = self::$widget->selectors; |
| 46 |
$fields = self::general_settings() |
| 47 |
+ InfoboxSettings::style_settings($widget) |
| 48 |
+ self::text_style_settings() |
| 49 |
+ self::fields_settings() |
| 50 |
+ ButtonSettings::style_settings($widget); |
| 51 |
return $fields; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Widget Field |
| 56 |
* |
| 57 |
* @return array |
| 58 |
*/ |
| 59 |
public static function text_style_settings() |
| 60 |
{ |
| 61 |
$fields = TextStyleSettings::widget_fields(self::$widget); |
| 62 |
$fields['section_style']['label'] = esc_html__('Description Style', 'shopbuilder'); |
| 63 |
$fields['section_style']['tab'] = 'style'; |
| 64 |
$fields['section_style']['condition'] = [ |
| 65 |
'show_description!' => '', |
| 66 |
]; |
| 67 |
|
| 68 |
$extra_controls['text_margin'] = [ |
| 69 |
'label' => esc_html__('Margin (px)', 'shopbuilder'), |
| 70 |
'type' => 'dimensions', |
| 71 |
'size_units' => ['px'], |
| 72 |
'selectors' => [ |
| 73 |
self::$selectors['text_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 74 |
], |
| 75 |
]; |
| 76 |
|
| 77 |
$fields = Fns::insert_controls('section_style_end', $fields, $extra_controls); |
| 78 |
|
| 79 |
return $fields; |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* Widget Field |
| 84 |
* |
| 85 |
* @return array |
| 86 |
*/ |
| 87 |
public static function general_settings() |
| 88 |
{ |
| 89 |
$fields = [ |
| 90 |
'section_general' => [ |
| 91 |
'mode' => 'section_start', |
| 92 |
'label' => esc_html__('General', 'shopbuilder'), |
| 93 |
], |
| 94 |
'show_description' => [ |
| 95 |
'label' => esc_html__('Show Description?', 'shopbuilder'), |
| 96 |
'type' => 'switch', |
| 97 |
'description' => esc_html__('Switch on to show Description.', 'shopbuilder'), |
| 98 |
'separator' => 'default', |
| 99 |
'default' => 'yes' |
| 100 |
], |
| 101 |
'description_text' => [ |
| 102 |
'label' => esc_html__('Description Text', 'shopbuilder'), |
| 103 |
'type' => 'textarea', |
| 104 |
'description' => esc_html__('Write Description Text. Leave Empty for default text.', 'shopbuilder'), |
| 105 |
'condition' => [ |
| 106 |
'show_description' => 'yes', |
| 107 |
], |
| 108 |
], |
| 109 |
'section_general_end' => [ |
| 110 |
'mode' => 'section_end', |
| 111 |
], |
| 112 |
]; |
| 113 |
return $fields; |
| 114 |
} |
| 115 |
|
| 116 |
/** |
| 117 |
* Widget Field |
| 118 |
* |
| 119 |
* @return array |
| 120 |
*/ |
| 121 |
public static function fields_settings() |
| 122 |
{ |
| 123 |
$fields = [ |
| 124 |
'fields_style_start' => [ |
| 125 |
'mode' => 'section_start', |
| 126 |
'tab' => 'style', |
| 127 |
'label' => esc_html__('Form', 'shopbuilder'), |
| 128 |
], |
| 129 |
'fields_height' => [ |
| 130 |
'label' => esc_html__('Fields Height', 'shopbuilder'), |
| 131 |
'type' => 'slider', |
| 132 |
'separator' => 'default', |
| 133 |
'range' => [ |
| 134 |
'px' => [ |
| 135 |
'min' => 10, |
| 136 |
'max' => 200, |
| 137 |
], |
| 138 |
], |
| 139 |
'selectors' => [ |
| 140 |
self::$selectors['fields_height'] => 'height: {{SIZE}}{{UNIT}};', |
| 141 |
], |
| 142 |
], |
| 143 |
'fields_tabs_start' => [ |
| 144 |
'mode' => 'tabs_start', |
| 145 |
], |
| 146 |
// Tab For normal view. |
| 147 |
'fields_normal' => [ |
| 148 |
'mode' => 'tab_start', |
| 149 |
'label' => esc_html__('Normal', 'shopbuilder'), |
| 150 |
], |
| 151 |
'fields_border' => [ |
| 152 |
'mode' => 'group', |
| 153 |
'type' => 'border', |
| 154 |
'selector' => self::$selectors['fields_border'], |
| 155 |
'size_units' => ['px'], |
| 156 |
], |
| 157 |
'form_fields_border_radius' => [ |
| 158 |
'label' => esc_html__('Border Radius (px)', 'shopbuilder'), |
| 159 |
'type' => 'dimensions', |
| 160 |
'size_units' => ['px'], |
| 161 |
'selectors' => [ |
| 162 |
self::$selectors['form_fields_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 163 |
], |
| 164 |
], |
| 165 |
'fields_text_color' => [ |
| 166 |
'label' => esc_html__('Text Color', 'shopbuilder'), |
| 167 |
'type' => 'color', |
| 168 |
|
| 169 |
'selectors' => [ |
| 170 |
self::$selectors['fields_text_color'] => 'color: {{VALUE}};', |
| 171 |
], |
| 172 |
], |
| 173 |
'fields_bg_color' => [ |
| 174 |
'label' => esc_html__('Background Color', 'shopbuilder'), |
| 175 |
'type' => 'color', |
| 176 |
'alpha' => true, |
| 177 |
'selectors' => [ |
| 178 |
self::$selectors['fields_bg_color'] => 'background-color: {{VALUE}};', |
| 179 |
], |
| 180 |
], |
| 181 |
'fields_normal_end' => [ |
| 182 |
'mode' => 'tab_end', |
| 183 |
], |
| 184 |
'fields_hover' => [ |
| 185 |
'mode' => 'tab_start', |
| 186 |
'label' => esc_html__('Hover & Focus', 'shopbuilder'), |
| 187 |
], |
| 188 |
'fields_hover_border' => [ |
| 189 |
'mode' => 'group', |
| 190 |
'type' => 'border', |
| 191 |
'selector' => self::$selectors['fields_hover_border'], |
| 192 |
'size_units' => ['px'], |
| 193 |
], |
| 194 |
'form_fields_border_radius_hover' => [ |
| 195 |
'label' => esc_html__('Border Radius (px)', 'shopbuilder'), |
| 196 |
'type' => 'dimensions', |
| 197 |
'size_units' => ['px'], |
| 198 |
'selectors' => [ |
| 199 |
self::$selectors['form_fields_border_radius_hover'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 200 |
], |
| 201 |
], |
| 202 |
'fields_hover_text_color' => [ |
| 203 |
'label' => esc_html__('Text Color', 'shopbuilder'), |
| 204 |
'type' => 'color', |
| 205 |
'selectors' => [ |
| 206 |
self::$selectors['fields_hover_text_color'] => 'color: {{VALUE}};', |
| 207 |
], |
| 208 |
], |
| 209 |
'fields_hover_bg_color' => [ |
| 210 |
'label' => esc_html__('Background Color', 'shopbuilder'), |
| 211 |
'type' => 'color', |
| 212 |
'alpha' => true, |
| 213 |
'selectors' => [ |
| 214 |
self::$selectors['fields_hover_bg_color'] => 'background-color: {{VALUE}};', |
| 215 |
], |
| 216 |
], |
| 217 |
'fields_hover_end' => [ |
| 218 |
'mode' => 'tab_end', |
| 219 |
], |
| 220 |
'fields_tabs_end' => [ |
| 221 |
'mode' => 'tabs_end', |
| 222 |
], |
| 223 |
'fields_padding' => [ |
| 224 |
'label' => esc_html__('Fields Padding (px)', 'shopbuilder'), |
| 225 |
'type' => 'dimensions', |
| 226 |
'mode' => 'responsive', |
| 227 |
'size_units' => ['px'], |
| 228 |
'selectors' => [ |
| 229 |
self::$selectors['fields_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 230 |
], |
| 231 |
], |
| 232 |
'fields_gap' => [ |
| 233 |
'label' => esc_html__('Fields Gap', 'shopbuilder'), |
| 234 |
'type' => 'slider', |
| 235 |
'separator' => 'default', |
| 236 |
'range' => [ |
| 237 |
'px' => [ |
| 238 |
'min' => 0, |
| 239 |
'max' => 100, |
| 240 |
], |
| 241 |
], |
| 242 |
'selectors' => [ |
| 243 |
self::$selectors['fields_gap'] => 'gap: {{SIZE}}{{UNIT}};', |
| 244 |
], |
| 245 |
], |
| 246 |
'form_margin' => [ |
| 247 |
'label' => esc_html__('Form Margin (px)', 'shopbuilder'), |
| 248 |
'mode' => 'responsive', |
| 249 |
'type' => 'dimensions', |
| 250 |
'size_units' => ['px'], |
| 251 |
'selectors' => [ |
| 252 |
self::$selectors['form_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 253 |
], |
| 254 |
], |
| 255 |
|
| 256 |
'fields_style_end' => [ |
| 257 |
'mode' => 'section_end', |
| 258 |
], |
| 259 |
]; |
| 260 |
return $fields; |
| 261 |
} |
| 262 |
} |
| 263 |
|