| 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 |
self::$widget = $widget; |
| 44 |
self::$selectors = self::$widget->selectors; |
| 45 |
return array_merge( |
| 46 |
self::general_settings(), |
| 47 |
InfoboxSettings::style_settings( $widget ), |
| 48 |
self::text_style_settings(), |
| 49 |
self::fields_settings(), |
| 50 |
ButtonSettings::style_settings( $widget ) |
| 51 |
); |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Widget Field |
| 56 |
* |
| 57 |
* @return array |
| 58 |
*/ |
| 59 |
public static function text_style_settings() { |
| 60 |
$fields = TextStyleSettings::widget_fields( self::$widget ); |
| 61 |
$fields['section_style']['label'] = esc_html__( 'Description Style', 'shopbuilder' ); |
| 62 |
$fields['section_style']['tab'] = 'style'; |
| 63 |
$fields['section_style']['condition'] = [ |
| 64 |
'show_description!' => '', |
| 65 |
]; |
| 66 |
|
| 67 |
$extra_controls['text_margin'] = [ |
| 68 |
'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), |
| 69 |
'type' => 'dimensions', |
| 70 |
'mode' => 'responsive', |
| 71 |
'size_units' => [ 'px' ], |
| 72 |
'selectors' => [ |
| 73 |
self::$selectors['text_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} ;', |
| 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 |
$fields = [ |
| 89 |
'section_general' => [ |
| 90 |
'mode' => 'section_start', |
| 91 |
'label' => esc_html__( 'General', 'shopbuilder' ), |
| 92 |
], |
| 93 |
'show_info_icon' => [ |
| 94 |
'label' => esc_html__( 'Show Custom Icon?', 'shopbuilder' ), |
| 95 |
'type' => 'switch', |
| 96 |
'description' => esc_html__( 'Switch on to show Custom Icon.', 'shopbuilder' ), |
| 97 |
'default' => 'yes', |
| 98 |
], |
| 99 |
'info_icon' => [ |
| 100 |
'label' => esc_html__( 'Icon', 'shopbuilder' ), |
| 101 |
'type' => 'icons', |
| 102 |
'description' => esc_html__( 'Change Icons.', 'shopbuilder' ), |
| 103 |
'condition' => [ |
| 104 |
'show_info_icon' => 'yes', |
| 105 |
], |
| 106 |
], |
| 107 |
'show_description' => [ |
| 108 |
'label' => esc_html__( 'Show Description?', 'shopbuilder' ), |
| 109 |
'type' => 'switch', |
| 110 |
'description' => esc_html__( 'Switch on to show Description.', 'shopbuilder' ), |
| 111 |
'default' => 'yes', |
| 112 |
], |
| 113 |
'description_text' => [ |
| 114 |
'label' => esc_html__( 'Description Text', 'shopbuilder' ), |
| 115 |
'type' => 'textarea', |
| 116 |
'description' => esc_html__( 'Write Description Text. Leave Empty for default text.', 'shopbuilder' ), |
| 117 |
'condition' => [ |
| 118 |
'show_description' => 'yes', |
| 119 |
], |
| 120 |
], |
| 121 |
'section_general_end' => [ |
| 122 |
'mode' => 'section_end', |
| 123 |
], |
| 124 |
]; |
| 125 |
return $fields; |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* Widget Field |
| 130 |
* |
| 131 |
* @return array |
| 132 |
*/ |
| 133 |
public static function fields_settings() { |
| 134 |
$fields = [ |
| 135 |
'fields_style_start' => [ |
| 136 |
'mode' => 'section_start', |
| 137 |
'tab' => 'style', |
| 138 |
'label' => esc_html__( 'Form Area', 'shopbuilder' ), |
| 139 |
], |
| 140 |
'fields_height' => [ |
| 141 |
'label' => esc_html__( 'Fields Height', 'shopbuilder' ), |
| 142 |
'type' => 'slider', |
| 143 |
'separator' => 'default', |
| 144 |
'range' => [ |
| 145 |
'px' => [ |
| 146 |
'min' => 10, |
| 147 |
'max' => 200, |
| 148 |
], |
| 149 |
], |
| 150 |
'selectors' => [ |
| 151 |
self::$selectors['fields_height'] => 'height: {{SIZE}}{{UNIT}};', |
| 152 |
], |
| 153 |
], |
| 154 |
'fields_tabs_start' => [ |
| 155 |
'mode' => 'tabs_start', |
| 156 |
], |
| 157 |
// Tab For normal view. |
| 158 |
'fields_normal' => [ |
| 159 |
'mode' => 'tab_start', |
| 160 |
'label' => esc_html__( 'Normal', 'shopbuilder' ), |
| 161 |
], |
| 162 |
'fields_border' => [ |
| 163 |
'mode' => 'group', |
| 164 |
'type' => 'border', |
| 165 |
'fields_options' => [ |
| 166 |
'border' => [ |
| 167 |
'label' => esc_html__( 'Field Border', 'shopbuilder' ), |
| 168 |
], |
| 169 |
'color' => [ |
| 170 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 171 |
], |
| 172 |
], |
| 173 |
'selector' => self::$selectors['fields_border'], |
| 174 |
'size_units' => [ 'px' ], |
| 175 |
], |
| 176 |
'form_fields_border_radius' => [ |
| 177 |
'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), |
| 178 |
'type' => 'dimensions', |
| 179 |
'size_units' => [ 'px' ], |
| 180 |
'selectors' => [ |
| 181 |
self::$selectors['form_fields_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 182 |
], |
| 183 |
], |
| 184 |
'fields_text_color' => [ |
| 185 |
'label' => esc_html__( 'Text Color', 'shopbuilder' ), |
| 186 |
'type' => 'color', |
| 187 |
|
| 188 |
'selectors' => [ |
| 189 |
self::$selectors['fields_text_color'] => 'color: {{VALUE}};', |
| 190 |
], |
| 191 |
], |
| 192 |
'fields_bg_color' => [ |
| 193 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 194 |
'type' => 'color', |
| 195 |
'alpha' => true, |
| 196 |
'selectors' => [ |
| 197 |
self::$selectors['fields_bg_color'] => 'background-color: {{VALUE}};', |
| 198 |
], |
| 199 |
], |
| 200 |
'fields_normal_end' => [ |
| 201 |
'mode' => 'tab_end', |
| 202 |
], |
| 203 |
'fields_hover' => [ |
| 204 |
'mode' => 'tab_start', |
| 205 |
'label' => esc_html__( 'Hover & Focus', 'shopbuilder' ), |
| 206 |
], |
| 207 |
'fields_hover_border' => [ |
| 208 |
'mode' => 'group', |
| 209 |
'type' => 'border', |
| 210 |
'selector' => self::$selectors['fields_hover_border'], |
| 211 |
'size_units' => [ 'px' ], |
| 212 |
], |
| 213 |
'form_fields_border_radius_hover' => [ |
| 214 |
'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), |
| 215 |
'type' => 'dimensions', |
| 216 |
'size_units' => [ 'px' ], |
| 217 |
'selectors' => [ |
| 218 |
self::$selectors['form_fields_border_radius_hover'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 219 |
], |
| 220 |
], |
| 221 |
'fields_hover_text_color' => [ |
| 222 |
'label' => esc_html__( 'Text Color', 'shopbuilder' ), |
| 223 |
'type' => 'color', |
| 224 |
'selectors' => [ |
| 225 |
self::$selectors['fields_hover_text_color'] => 'color: {{VALUE}};', |
| 226 |
], |
| 227 |
], |
| 228 |
'fields_hover_bg_color' => [ |
| 229 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 230 |
'type' => 'color', |
| 231 |
'alpha' => true, |
| 232 |
'selectors' => [ |
| 233 |
self::$selectors['fields_hover_bg_color'] => 'background-color: {{VALUE}};', |
| 234 |
], |
| 235 |
], |
| 236 |
'fields_hover_end' => [ |
| 237 |
'mode' => 'tab_end', |
| 238 |
], |
| 239 |
'fields_tabs_end' => [ |
| 240 |
'mode' => 'tabs_end', |
| 241 |
], |
| 242 |
|
| 243 |
'fields_padding' => [ |
| 244 |
'label' => esc_html__( 'Fields Padding (px)', 'shopbuilder' ), |
| 245 |
'type' => 'dimensions', |
| 246 |
'mode' => 'responsive', |
| 247 |
'size_units' => [ 'px' ], |
| 248 |
'selectors' => [ |
| 249 |
self::$selectors['fields_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 250 |
], |
| 251 |
], |
| 252 |
'fields_gap' => [ |
| 253 |
'label' => esc_html__( 'Fields Gap', 'shopbuilder' ), |
| 254 |
'type' => 'slider', |
| 255 |
'separator' => 'default', |
| 256 |
'range' => [ |
| 257 |
'px' => [ |
| 258 |
'min' => 0, |
| 259 |
'max' => 100, |
| 260 |
], |
| 261 |
], |
| 262 |
'selectors' => [ |
| 263 |
self::$selectors['fields_gap'] => 'gap: {{SIZE}}{{UNIT}};', |
| 264 |
], |
| 265 |
], |
| 266 |
'form_margin' => [ |
| 267 |
'label' => esc_html__( 'Form Margin (px)', 'shopbuilder' ), |
| 268 |
'mode' => 'responsive', |
| 269 |
'type' => 'dimensions', |
| 270 |
'size_units' => [ 'px' ], |
| 271 |
'selectors' => [ |
| 272 |
self::$selectors['form_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 273 |
], |
| 274 |
], |
| 275 |
|
| 276 |
'form_area_wrapper_border' => [ |
| 277 |
'mode' => 'group', |
| 278 |
'type' => 'border', |
| 279 |
'fields_options' => [ |
| 280 |
'border' => [ |
| 281 |
'label' => esc_html__( 'Form Area Border', 'shopbuilder' ), |
| 282 |
], |
| 283 |
'color' => [ |
| 284 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 285 |
], |
| 286 |
], |
| 287 |
'selector' => self::$selectors['form_area_wrapper_border'], |
| 288 |
'size_units' => [ 'px' ], |
| 289 |
], |
| 290 |
|
| 291 |
'form_area_padding' => [ |
| 292 |
'label' => esc_html__( 'Form Area Padding (px)', 'shopbuilder' ), |
| 293 |
'mode' => 'responsive', |
| 294 |
'type' => 'dimensions', |
| 295 |
'size_units' => [ 'px' ], |
| 296 |
'selectors' => [ |
| 297 |
self::$selectors['form_area_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 298 |
], |
| 299 |
], |
| 300 |
|
| 301 |
'form_area_margin' => [ |
| 302 |
'label' => esc_html__( 'Form Area Margin (px)', 'shopbuilder' ), |
| 303 |
'mode' => 'responsive', |
| 304 |
'type' => 'dimensions', |
| 305 |
'size_units' => [ 'px' ], |
| 306 |
'selectors' => [ |
| 307 |
self::$selectors['form_area_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 308 |
], |
| 309 |
], |
| 310 |
|
| 311 |
'form_area_border_radius' => [ |
| 312 |
'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), |
| 313 |
'type' => 'dimensions', |
| 314 |
'size_units' => [ 'px' ], |
| 315 |
'selectors' => [ |
| 316 |
self::$selectors['form_area_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 317 |
], |
| 318 |
], |
| 319 |
|
| 320 |
'fields_style_end' => [ |
| 321 |
'mode' => 'section_end', |
| 322 |
], |
| 323 |
]; |
| 324 |
return $fields; |
| 325 |
} |
| 326 |
} |
| 327 |
|