| 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 NoticeSettings { |
| 22 |
/** |
| 23 |
* Widget Control Selectors |
| 24 |
* |
| 25 |
* @var array |
| 26 |
*/ |
| 27 |
private static $selectors = []; |
| 28 |
/** |
| 29 |
* Widget |
| 30 |
* |
| 31 |
* @var array |
| 32 |
*/ |
| 33 |
private static $widget; |
| 34 |
/** |
| 35 |
* Widget Field |
| 36 |
* |
| 37 |
* @return array |
| 38 |
*/ |
| 39 |
public static function widget_fields( $widget ) { |
| 40 |
self::$widget = $widget; |
| 41 |
self::$selectors = $widget->selectors; |
| 42 |
return self::notice_style() + self::button_style(); |
| 43 |
} |
| 44 |
/** |
| 45 |
* Widget Field |
| 46 |
* |
| 47 |
* @return array |
| 48 |
*/ |
| 49 |
public static function notice_style() { |
| 50 |
return [ |
| 51 |
'notice_section' => [ |
| 52 |
'mode' => 'section_start', |
| 53 |
'label' => esc_html__( 'Notice', 'shopbuilder' ), |
| 54 |
], |
| 55 |
'notice_typo_note' => [ |
| 56 |
'type' => 'html', |
| 57 |
'raw' => sprintf( |
| 58 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 59 |
esc_html__( 'Typography', 'shopbuilder' ) |
| 60 |
), |
| 61 |
'content_classes' => 'elementor-panel-heading-title', |
| 62 |
], |
| 63 |
'notice_typography' => [ |
| 64 |
'mode' => 'group', |
| 65 |
'type' => 'typography', |
| 66 |
'label' => esc_html__( 'Typography', 'shopbuilder' ), |
| 67 |
'selector' => self::$selectors['notice_typography'], |
| 68 |
], |
| 69 |
'notice_icon_size' => [ |
| 70 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 71 |
'type' => 'slider', |
| 72 |
'range' => [ |
| 73 |
'px' => [ |
| 74 |
'min' => 10, |
| 75 |
'max' => 100, |
| 76 |
], |
| 77 |
], |
| 78 |
'selectors' => [ |
| 79 |
self::$selectors['notice_icon_size']['icon'] => 'font-size: {{SIZE}}{{UNIT}} !important;', |
| 80 |
self::$selectors['notice_icon_size']['svg'] => 'width: {{SIZE}}{{UNIT}} !important;', |
| 81 |
], |
| 82 |
], |
| 83 |
'notice_color_note' => [ |
| 84 |
'type' => 'html', |
| 85 |
'raw' => sprintf( |
| 86 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 87 |
esc_html__( 'Colors', 'shopbuilder' ) |
| 88 |
), |
| 89 |
'separator' => 'before-short', |
| 90 |
'content_classes' => 'elementor-panel-heading-title', |
| 91 |
], |
| 92 |
'notice_color_tab' => [ |
| 93 |
'mode' => 'tabs_start', |
| 94 |
], |
| 95 |
'notice_common_color_tab_start' => [ |
| 96 |
'mode' => 'tab_start', |
| 97 |
'label' => esc_html__( 'Common', 'shopbuilder' ), |
| 98 |
], |
| 99 |
'notice_bg_color' => [ |
| 100 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 101 |
'type' => 'color', |
| 102 |
'selectors' => [ |
| 103 |
self::$selectors['notice_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 104 |
], |
| 105 |
], |
| 106 |
'notice_text_color' => [ |
| 107 |
'label' => esc_html__( 'Text Color', 'shopbuilder' ), |
| 108 |
'type' => 'color', |
| 109 |
'selectors' => [ |
| 110 |
self::$selectors['notice_text_color'] => 'color: {{VALUE}} !important;', |
| 111 |
], |
| 112 |
], |
| 113 |
'notice_border_color' => [ |
| 114 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 115 |
'type' => 'color', |
| 116 |
'selectors' => [ |
| 117 |
self::$selectors['notice_border_color'] => 'border-color: {{VALUE}} !important;', |
| 118 |
], |
| 119 |
], |
| 120 |
'notice_icon_color' => [ |
| 121 |
'label' => esc_html__( 'Icon Color', 'shopbuilder' ), |
| 122 |
'type' => 'color', |
| 123 |
'selectors' => [ |
| 124 |
self::$selectors['notice_icon_color']['icon'] => 'color: {{VALUE}} !important;', |
| 125 |
self::$selectors['notice_icon_color']['svg'] => 'fill: {{VALUE}} !important;', |
| 126 |
], |
| 127 |
], |
| 128 |
'notice_icon_bg_color' => [ |
| 129 |
'label' => esc_html__( 'Icon Background Color', 'shopbuilder' ), |
| 130 |
'type' => 'color', |
| 131 |
'selectors' => [ |
| 132 |
self::$selectors['notice_icon_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 133 |
], |
| 134 |
], |
| 135 |
'notice_common_color_tab_end' => [ |
| 136 |
'mode' => 'tab_end', |
| 137 |
], |
| 138 |
'notice_success_color_tab_start' => [ |
| 139 |
'mode' => 'tab_start', |
| 140 |
'label' => esc_html__( 'Success', 'shopbuilder' ), |
| 141 |
], |
| 142 |
'notice_success_bg_color' => [ |
| 143 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 144 |
'type' => 'color', |
| 145 |
'selectors' => [ |
| 146 |
self::$selectors['notice_success_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 147 |
], |
| 148 |
], |
| 149 |
'notice_success_text_color' => [ |
| 150 |
'label' => esc_html__( 'Text Color', 'shopbuilder' ), |
| 151 |
'type' => 'color', |
| 152 |
'selectors' => [ |
| 153 |
self::$selectors['notice_success_text_color'] => 'color: {{VALUE}} !important;', |
| 154 |
], |
| 155 |
], |
| 156 |
'notice_success_border_color' => [ |
| 157 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 158 |
'type' => 'color', |
| 159 |
'selectors' => [ |
| 160 |
self::$selectors['notice_success_border_color'] => 'border-color: {{VALUE}} !important;', |
| 161 |
], |
| 162 |
], |
| 163 |
'notice_success_icon_color' => [ |
| 164 |
'label' => esc_html__( 'Icon Color', 'shopbuilder' ), |
| 165 |
'type' => 'color', |
| 166 |
'selectors' => [ |
| 167 |
self::$selectors['notice_success_icon_color']['icon'] => 'color: {{VALUE}} !important;', |
| 168 |
self::$selectors['notice_success_icon_color']['svg'] => 'fill: {{VALUE}} !important;', |
| 169 |
], |
| 170 |
], |
| 171 |
'notice_success_icon_bg_color' => [ |
| 172 |
'label' => esc_html__( 'Icon Background Color', 'shopbuilder' ), |
| 173 |
'type' => 'color', |
| 174 |
'selectors' => [ |
| 175 |
self::$selectors['notice_success_icon_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 176 |
], |
| 177 |
], |
| 178 |
'notice_success_color_tab_end' => [ |
| 179 |
'mode' => 'tab_end', |
| 180 |
], |
| 181 |
'notice_error_color_tab_start' => [ |
| 182 |
'mode' => 'tab_start', |
| 183 |
'label' => esc_html__( 'Error', 'shopbuilder' ), |
| 184 |
], |
| 185 |
'notice_error_bg_color' => [ |
| 186 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 187 |
'type' => 'color', |
| 188 |
|
| 189 |
'selectors' => [ |
| 190 |
self::$selectors['notice_error_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 191 |
], |
| 192 |
], |
| 193 |
'notice_error_text_color' => [ |
| 194 |
'label' => esc_html__( 'Text Color', 'shopbuilder' ), |
| 195 |
'type' => 'color', |
| 196 |
|
| 197 |
'selectors' => [ |
| 198 |
self::$selectors['notice_error_text_color'] => 'color: {{VALUE}} !important;', |
| 199 |
], |
| 200 |
], |
| 201 |
'notice_error_border_color' => [ |
| 202 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 203 |
'type' => 'color', |
| 204 |
'selectors' => [ |
| 205 |
self::$selectors['notice_error_border_color'] => 'border-color: {{VALUE}} !important;', |
| 206 |
], |
| 207 |
], |
| 208 |
'notice_error_icon_color' => [ |
| 209 |
'label' => esc_html__( 'Icon Color', 'shopbuilder' ), |
| 210 |
'type' => 'color', |
| 211 |
'selectors' => [ |
| 212 |
self::$selectors['notice_error_icon_color']['icon'] => 'color: {{VALUE}} !important;', |
| 213 |
self::$selectors['notice_error_icon_color']['svg'] => 'fill: {{VALUE}} !important;', |
| 214 |
], |
| 215 |
], |
| 216 |
'notice_error_icon_bg_color' => [ |
| 217 |
'label' => esc_html__( 'Icon Background Color', 'shopbuilder' ), |
| 218 |
'type' => 'color', |
| 219 |
'selectors' => [ |
| 220 |
self::$selectors['notice_error_icon_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 221 |
], |
| 222 |
], |
| 223 |
'notice_error_color_tab_end' => [ |
| 224 |
'mode' => 'tab_end', |
| 225 |
], |
| 226 |
'notice_info_color_tab_start' => [ |
| 227 |
'mode' => 'tab_start', |
| 228 |
'label' => esc_html__( 'Info', 'shopbuilder' ), |
| 229 |
], |
| 230 |
'notice_info_bg_color' => [ |
| 231 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 232 |
'type' => 'color', |
| 233 |
'selectors' => [ |
| 234 |
self::$selectors['notice_info_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 235 |
], |
| 236 |
], |
| 237 |
'notice_info_text_color' => [ |
| 238 |
'label' => esc_html__( 'Text Color', 'shopbuilder' ), |
| 239 |
'type' => 'color', |
| 240 |
'selectors' => [ |
| 241 |
self::$selectors['notice_info_text_color'] => 'color: {{VALUE}} !important;', |
| 242 |
], |
| 243 |
], |
| 244 |
'notice_info_border_color' => [ |
| 245 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 246 |
'type' => 'color', |
| 247 |
'selectors' => [ |
| 248 |
self::$selectors['notice_info_border_color'] => 'border-color: {{VALUE}} !important;', |
| 249 |
], |
| 250 |
], |
| 251 |
'notice_info_icon_color' => [ |
| 252 |
'label' => esc_html__( 'Icon Color', 'shopbuilder' ), |
| 253 |
'type' => 'color', |
| 254 |
'selectors' => [ |
| 255 |
self::$selectors['notice_info_icon_color']['icon'] => 'color: {{VALUE}} !important;', |
| 256 |
self::$selectors['notice_info_icon_color']['svg'] => 'fill: {{VALUE}} !important;', |
| 257 |
], |
| 258 |
], |
| 259 |
'notice_info_icon_bg_color' => [ |
| 260 |
'label' => esc_html__( 'Icon Background Color', 'shopbuilder' ), |
| 261 |
'type' => 'color', |
| 262 |
'selectors' => [ |
| 263 |
self::$selectors['notice_info_icon_bg_color'] => 'background-color: {{VALUE}} !important;', |
| 264 |
], |
| 265 |
], |
| 266 |
'notice_info_color_tab_end' => [ |
| 267 |
'mode' => 'tab_end', |
| 268 |
], |
| 269 |
'notice_color_tab_end' => [ |
| 270 |
'mode' => 'tabs_end', |
| 271 |
], |
| 272 |
'notice_spacing_note' => [ |
| 273 |
'type' => 'html', |
| 274 |
'raw' => sprintf( |
| 275 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 276 |
esc_html__( 'Spacings', 'shopbuilder' ) |
| 277 |
), |
| 278 |
'separator' => 'before-short', |
| 279 |
'content_classes' => 'elementor-panel-heading-title', |
| 280 |
], |
| 281 |
'notice_gap_multiple' => [ |
| 282 |
'label' => esc_html__( 'Spacing for Multiple Notice', 'shopbuilder' ), |
| 283 |
'description' => esc_html__( 'This spacing will apply between multiple notices.', 'shopbuilder' ), |
| 284 |
'type' => 'slider', |
| 285 |
'range' => [ |
| 286 |
'px' => [ |
| 287 |
'min' => 0, |
| 288 |
'max' => 100, |
| 289 |
], |
| 290 |
], |
| 291 |
'selectors' => [ |
| 292 |
self::$selectors['notice_gap_multiple'] => 'gap: {{SIZE}}{{UNIT}} !important;', |
| 293 |
], |
| 294 |
], |
| 295 |
'notice_icon_gap' => [ |
| 296 |
'label' => esc_html__( 'Icon Spacing', 'shopbuilder' ), |
| 297 |
'type' => 'slider', |
| 298 |
'range' => [ |
| 299 |
'px' => [ |
| 300 |
'min' => 0, |
| 301 |
'max' => 100, |
| 302 |
], |
| 303 |
], |
| 304 |
'selectors' => [ |
| 305 |
self::$selectors['notice_icon_gap'] => 'gap: {{SIZE}}{{UNIT}} !important;', |
| 306 |
], |
| 307 |
], |
| 308 |
'notice_padding' => [ |
| 309 |
'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), |
| 310 |
'type' => 'dimensions', |
| 311 |
'mode' => 'responsive', |
| 312 |
'size_units' => [ 'px' ], |
| 313 |
'selectors' => [ |
| 314 |
self::$selectors['notice_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 315 |
], |
| 316 |
], |
| 317 |
'notice_border_radius' => [ |
| 318 |
'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), |
| 319 |
'type' => 'dimensions', |
| 320 |
'size_units' => [ 'px' ], |
| 321 |
'selectors' => [ |
| 322 |
self::$selectors['notice_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 323 |
], |
| 324 |
], |
| 325 |
'notice_section_end' => [ |
| 326 |
'mode' => 'section_end', |
| 327 |
], |
| 328 |
]; |
| 329 |
} |
| 330 |
/** |
| 331 |
* Widget Field |
| 332 |
* |
| 333 |
* @return array |
| 334 |
*/ |
| 335 |
public static function button_style() { |
| 336 |
$fields = ButtonSettings::style_settings( self::$widget ); |
| 337 |
|
| 338 |
unset( $fields['button_section_start']['tab'] ); |
| 339 |
|
| 340 |
$extra_controls = []; |
| 341 |
|
| 342 |
$extra_controls['notice_button_alignment'] = [ |
| 343 |
'type' => 'choose', |
| 344 |
'label' => esc_html__( 'Text Alignment', 'shopbuilder' ), |
| 345 |
'options' => [ |
| 346 |
'left' => [ |
| 347 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 348 |
'icon' => 'eicon-text-align-left', |
| 349 |
], |
| 350 |
'center' => [ |
| 351 |
'title' => esc_html__( 'Center', 'shopbuilder' ), |
| 352 |
'icon' => 'eicon-text-align-center', |
| 353 |
], |
| 354 |
'right' => [ |
| 355 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 356 |
'icon' => 'eicon-text-align-right', |
| 357 |
], |
| 358 |
], |
| 359 |
'default' => 'left', |
| 360 |
'toggle' => true, |
| 361 |
'selectors' => [ |
| 362 |
self::$selectors['notice_button_alignment'] => 'justify-content: {{VALUE}} !important;', |
| 363 |
], |
| 364 |
]; |
| 365 |
|
| 366 |
return Fns::insert_controls( 'button_height', $fields, $extra_controls ); |
| 367 |
} |
| 368 |
} |
| 369 |
|