← All changes
|
app/Elementor/Widgets/Controls/ReviewsSettings.php
+503
-522
2.1.11
→
1.1.4
View file →
| @@ -1,522 +1,503 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Main ReviewsSettings 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\Elementor\Helper\ControlHelper; | |
| 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 Review Settings class | |
| 20 | - */ | |
| 21 | -class ReviewsSettings { | |
| 22 | - /** | |
| 23 | - * Widget Control Selectors | |
| 24 | - * | |
| 25 | - * @var array | |
| 26 | - */ | |
| 27 | - private static $widget; | |
| 28 | - /** | |
| 29 | - * Widget Control Selectors | |
| 30 | - * | |
| 31 | - * @var array | |
| 32 | - */ | |
| 33 | - private static $selectors = []; | |
| 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 | - $fields = self::heading_controls() + | |
| 43 | - self::review_style() + | |
| 44 | - ReviewsStarSettings::widget_fields( $widget ) + | |
| 45 | - self::review_form() + | |
| 46 | - self::form_button(); | |
| 47 | - return $fields; | |
| 48 | - } | |
| 49 | - /** | |
| 50 | - * Widget Field | |
| 51 | - * | |
| 52 | - * @return array | |
| 53 | - */ | |
| 54 | - public static function form_button() { | |
| 55 | - $alignment = ControlHelper::alignment(); | |
| 56 | - unset( $alignment['justify'] ); | |
| 57 | - $fields = [ | |
| 58 | - 'button_section_start' => [ | |
| 59 | - 'mode' => 'section_start', | |
| 60 | - 'label' => esc_html__( 'Button', 'shopbuilder' ), | |
| 61 | - 'tab' => 'style', | |
| 62 | - ], | |
| 63 | - 'button_typography' => [ | |
| 64 | - 'mode' => 'group', | |
| 65 | - 'type' => 'typography', | |
| 66 | - 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 67 | - 'selector' => self::$selectors['button_typography'], | |
| 68 | - ], | |
| 69 | - 'submit_button_alignment' => [ | |
| 70 | - 'label' => esc_html__( 'Alignment', 'shopbuilder' ), | |
| 71 | - 'type' => 'choose', | |
| 72 | - 'options' => $alignment, | |
| 73 | - 'default' => 'left', | |
| 74 | - 'selectors' => [ | |
| 75 | - self::$selectors['submit_button_alignment']['text-align'] => 'text-align: {{VALUE}} !important;', | |
| 76 | - self::$selectors['submit_button_alignment']['float'] => 'float: none;', | |
| 77 | - ], | |
| 78 | - ], | |
| 79 | - | |
| 80 | - 'button_tabs_start' => [ | |
| 81 | - 'mode' => 'tabs_start', | |
| 82 | - ], | |
| 83 | - // Tab For normal view. | |
| 84 | - 'button_normal' => [ | |
| 85 | - 'mode' => 'tab_start', | |
| 86 | - 'label' => esc_html__( 'Normal', 'shopbuilder' ), | |
| 87 | - ], | |
| 88 | - 'button_text_color_normal' => [ | |
| 89 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 90 | - 'type' => 'color', | |
| 91 | - | |
| 92 | - 'separator' => 'default', | |
| 93 | - 'selectors' => [ | |
| 94 | - self::$selectors['button_text_color_normal'] => 'color: {{VALUE}};', | |
| 95 | - ], | |
| 96 | - ], | |
| 97 | - 'button_bg_color_normal' => [ | |
| 98 | - 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 99 | - 'type' => 'color', | |
| 100 | - 'alpha' => true, | |
| 101 | - 'selectors' => [ | |
| 102 | - self::$selectors['button_bg_color_normal'] => 'background-color: {{VALUE}};', | |
| 103 | - ], | |
| 104 | - ], | |
| 105 | - 'button_border' => [ | |
| 106 | - 'mode' => 'group', | |
| 107 | - 'type' => 'border', | |
| 108 | - 'selector' => self::$selectors['button_border'], | |
| 109 | - 'size_units' => [ 'px' ], | |
| 110 | - ], | |
| 111 | - 'button_normal_end' => [ | |
| 112 | - 'mode' => 'tab_end', | |
| 113 | - ], | |
| 114 | - 'button_hover' => [ | |
| 115 | - 'mode' => 'tab_start', | |
| 116 | - 'label' => esc_html__( 'Hover', 'shopbuilder' ), | |
| 117 | - ], | |
| 118 | - 'button_text_color_hover' => [ | |
| 119 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 120 | - 'type' => 'color', | |
| 121 | - | |
| 122 | - 'separator' => 'default', | |
| 123 | - 'selectors' => [ | |
| 124 | - self::$selectors['button_text_color_hover'] => 'color: {{VALUE}};', | |
| 125 | - ], | |
| 126 | - ], | |
| 127 | - 'button_bg_color_hover' => [ | |
| 128 | - 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 129 | - 'type' => 'color', | |
| 130 | - 'alpha' => true, | |
| 131 | - 'selectors' => [ | |
| 132 | - self::$selectors['button_bg_color_hover'] => 'background-color: {{VALUE}};', | |
| 133 | - ], | |
| 134 | - ], | |
| 135 | - 'button_border_hover_color' => [ | |
| 136 | - 'label' => esc_html__( 'Border Color', 'shopbuilder' ), | |
| 137 | - 'type' => 'color', | |
| 138 | - | |
| 139 | - 'selectors' => [ | |
| 140 | - self::$selectors['button_border_hover_color'] => 'border-color: {{VALUE}};', | |
| 141 | - ], | |
| 142 | - ], | |
| 143 | - 'button_hover_end' => [ | |
| 144 | - 'mode' => 'tab_end', | |
| 145 | - ], | |
| 146 | - 'button_tabs_end' => [ | |
| 147 | - 'mode' => 'tabs_end', | |
| 148 | - ], | |
| 149 | - 'button_border_radius' => [ | |
| 150 | - 'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), | |
| 151 | - 'type' => 'dimensions', | |
| 152 | - 'mode' => 'responsive', | |
| 153 | - 'size_units' => [ 'px' ], | |
| 154 | - 'selectors' => [ | |
| 155 | - self::$selectors['button_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 156 | - ], | |
| 157 | - ], | |
| 158 | - 'button_padding' => [ | |
| 159 | - 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), | |
| 160 | - 'type' => 'dimensions', | |
| 161 | - 'mode' => 'responsive', | |
| 162 | - 'size_units' => [ 'px' ], | |
| 163 | - 'selectors' => [ | |
| 164 | - self::$selectors['button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 165 | - ], | |
| 166 | - 'separator' => 'before', | |
| 167 | - ], | |
| 168 | - 'button_margin' => [ | |
| 169 | - 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 170 | - 'type' => 'dimensions', | |
| 171 | - 'mode' => 'responsive', | |
| 172 | - 'size_units' => [ 'px' ], | |
| 173 | - 'selectors' => [ | |
| 174 | - self::$selectors['button_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 175 | - ], | |
| 176 | - ], | |
| 177 | - 'butotn_section_end' => [ | |
| 178 | - 'mode' => 'section_end', | |
| 179 | - ], | |
| 180 | - ]; | |
| 181 | - return $fields; | |
| 182 | - } | |
| 183 | - /** | |
| 184 | - * Widget Field | |
| 185 | - * | |
| 186 | - * @return array | |
| 187 | - */ | |
| 188 | - public static function review_form() { | |
| 189 | - $fields = [ | |
| 190 | - 'form_section_start' => [ | |
| 191 | - 'mode' => 'section_start', | |
| 192 | - 'label' => esc_html__( 'Review Form Heading', 'shopbuilder' ), | |
| 193 | - 'tab' => 'style', | |
| 194 | - ], | |
| 195 | - 'form_heading_typography' => [ | |
| 196 | - 'mode' => 'group', | |
| 197 | - 'type' => 'typography', | |
| 198 | - 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 199 | - 'selector' => self::$selectors['form_heading_typography'], | |
| 200 | - 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude | |
| 201 | - ], | |
| 202 | - 'form_heading_color' => [ | |
| 203 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 204 | - 'type' => 'color', | |
| 205 | - 'selectors' => [ | |
| 206 | - self::$selectors['form_heading_color'] => 'color: {{VALUE}};', | |
| 207 | - ], | |
| 208 | - ], | |
| 209 | - 'noform_heading_text_color' => [ | |
| 210 | - 'label' => esc_html__( 'No Form Text Color', 'shopbuilder' ), | |
| 211 | - 'type' => 'color', | |
| 212 | - 'selectors' => [ | |
| 213 | - self::$selectors['noform_heading_color'] => 'color: {{VALUE}} !important;', | |
| 214 | - ], | |
| 215 | - ], | |
| 216 | - 'noform_heading_color' => [ | |
| 217 | - 'label' => esc_html__( 'No Form Text Background Color', 'shopbuilder' ), | |
| 218 | - 'type' => 'color', | |
| 219 | - 'selectors' => [ | |
| 220 | - self::$selectors['noform_heading_color'] => 'background-color: {{VALUE}} !important;', | |
| 221 | - ], | |
| 222 | - ], | |
| 223 | - 'form_title_margin' => [ | |
| 224 | - 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 225 | - 'type' => 'dimensions', | |
| 226 | - 'mode' => 'responsive', | |
| 227 | - 'size_units' => [ 'px' ], | |
| 228 | - 'selectors' => [ | |
| 229 | - self::$selectors['form_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;', | |
| 230 | - ], | |
| 231 | - 'separator' => 'before', | |
| 232 | - ], | |
| 233 | - 'formheading_section_end' => [ | |
| 234 | - 'mode' => 'section_end', | |
| 235 | - ], | |
| 236 | - 'review_form_section_start' => [ | |
| 237 | - 'mode' => 'section_start', | |
| 238 | - 'label' => esc_html__( 'Review Form', 'shopbuilder' ), | |
| 239 | - 'tab' => 'style', | |
| 240 | - ], | |
| 241 | - 'review_label_heading' => [ | |
| 242 | - 'type' => 'html', | |
| 243 | - 'raw' => sprintf( | |
| 244 | - '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 245 | - esc_html__( 'Input Label', 'shopbuilder' ) | |
| 246 | - ), | |
| 247 | - 'content_classes' => 'elementor-panel-heading-title', | |
| 248 | - 'separator' => 'default', | |
| 249 | - ], | |
| 250 | - 'input_label_typography' => [ | |
| 251 | - 'mode' => 'group', | |
| 252 | - 'type' => 'typography', | |
| 253 | - 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 254 | - 'selector' => self::$selectors['input_label_typography'], | |
| 255 | - 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude | |
| 256 | - ], | |
| 257 | - 'review_label_color' => [ | |
| 258 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 259 | - 'type' => 'color', | |
| 260 | - 'selectors' => [ | |
| 261 | - self::$selectors['review_label_color'] => 'color: {{VALUE}} ', | |
| 262 | - ], | |
| 263 | - ], | |
| 264 | - 'review_label_required' => [ | |
| 265 | - 'label' => esc_html__( 'Required Color', 'shopbuilder' ), | |
| 266 | - 'type' => 'color', | |
| 267 | - 'selectors' => [ | |
| 268 | - self::$selectors['review_label_required'] => 'color: {{VALUE}}', | |
| 269 | - ], | |
| 270 | - ], | |
| 271 | - 'review_input_heading' => [ | |
| 272 | - 'type' => 'html', | |
| 273 | - 'raw' => sprintf( | |
| 274 | - '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 275 | - esc_html__( 'Form Input', 'shopbuilder' ) | |
| 276 | - ), | |
| 277 | - 'content_classes' => 'elementor-panel-heading-title', | |
| 278 | - 'separator' => 'before', | |
| 279 | - ], | |
| 280 | - 'label_input_text_typography' => [ | |
| 281 | - 'mode' => 'group', | |
| 282 | - 'type' => 'typography', | |
| 283 | - 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 284 | - 'selector' => self::$selectors['label_input_text_typography'], | |
| 285 | - 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude | |
| 286 | - ], | |
| 287 | - 'review_input_color' => [ | |
| 288 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 289 | - 'type' => 'color', | |
| 290 | - // 'separator' => 'default', | |
| 291 | - 'selectors' => [ | |
| 292 | - self::$selectors['review_input_color'] => 'color: {{VALUE}};', | |
| 293 | - ], | |
| 294 | - ], | |
| 295 | - 'review_input_border_color' => [ | |
| 296 | - 'label' => esc_html__( 'Border Color', 'shopbuilder' ), | |
| 297 | - 'type' => 'color', | |
| 298 | - 'selectors' => [ | |
| 299 | - self::$selectors['review_input_border_color'] => 'border-color: {{VALUE}};', | |
| 300 | - ], | |
| 301 | - ], | |
| 302 | - 'review_input_border_color_focus' => [ | |
| 303 | - 'label' => esc_html__( 'Focus Border Color', 'shopbuilder' ), | |
| 304 | - 'type' => 'color', | |
| 305 | - 'selectors' => [ | |
| 306 | - self::$selectors['review_input_border_color_focus'] => 'border-color: {{VALUE}} !important;outline-color: {{VALUE}} !important;', | |
| 307 | - ], | |
| 308 | - ], | |
| 309 | - 'review_comment_field_height' => [ | |
| 310 | - 'mode' => 'responsive', | |
| 311 | - 'label' => esc_html__( 'Comment field height (px)', 'shopbuilder' ), | |
| 312 | - 'type' => 'slider', | |
| 313 | - 'size_units' => [ 'px' ], | |
| 314 | - 'range' => [ | |
| 315 | - 'px' => [ | |
| 316 | - 'min' => 50, | |
| 317 | - 'max' => 300, | |
| 318 | - 'step' => 1, | |
| 319 | - ], | |
| 320 | - ], | |
| 321 | - 'default' => [ | |
| 322 | - 'unit' => 'px', | |
| 323 | - 'size' => 100, | |
| 324 | - ], | |
| 325 | - 'selectors' => [ | |
| 326 | - self::$selectors['review_comment_field_height'] => 'height: {{SIZE}}{{UNIT}}!important;', | |
| 327 | - ], | |
| 328 | - ], | |
| 329 | - 'review_form_rating_size' => [ | |
| 330 | - 'mode' => 'responsive', | |
| 331 | - 'label' => esc_html__( 'Rating icon size (px)', 'shopbuilder' ), | |
| 332 | - 'type' => 'slider', | |
| 333 | - 'size_units' => [ 'px' ], | |
| 334 | - 'range' => [ | |
| 335 | - 'px' => [ | |
| 336 | - 'min' => 10, | |
| 337 | - 'max' => 100, | |
| 338 | - 'step' => 1, | |
| 339 | - ], | |
| 340 | - ], | |
| 341 | - 'selectors' => [ | |
| 342 | - self::$selectors['review_form_rating_size'] => 'font-size: {{SIZE}}{{UNIT}};', | |
| 343 | - ], | |
| 344 | - ], | |
| 345 | - 'review_field_spacing' => [ | |
| 346 | - 'label' => esc_html__( 'Field Spacing (px)', 'shopbuilder' ), | |
| 347 | - 'type' => 'slider', | |
| 348 | - 'size_units' => [ 'px' ], | |
| 349 | - 'range' => [ | |
| 350 | - 'px' => [ | |
| 351 | - 'min' => 0, | |
| 352 | - 'max' => 100, | |
| 353 | - 'step' => 1, | |
| 354 | - ], | |
| 355 | - ], | |
| 356 | - 'default' => [ | |
| 357 | - 'unit' => 'px', | |
| 358 | - 'size' => 15, | |
| 359 | - ], | |
| 360 | - 'selectors' => [ | |
| 361 | - self::$selectors['review_field_spacing']['margin-0'] => 'margin: 0;', | |
| 362 | - self::$selectors['review_field_spacing']['margin-buttom'] => 'margin-bottom: {{SIZE}}{{UNIT}}!important;', | |
| 363 | - ], | |
| 364 | - ], | |
| 365 | - 'review_input_border_radius' => [ | |
| 366 | - 'label' => esc_html__( 'Inputs Border Radius (px)', 'shopbuilder' ), | |
| 367 | - 'type' => 'slider', | |
| 368 | - 'size_units' => [ 'px' ], | |
| 369 | - 'range' => [ | |
| 370 | - 'px' => [ | |
| 371 | - 'min' => 0, | |
| 372 | - 'max' => 100, | |
| 373 | - 'step' => 1, | |
| 374 | - ], | |
| 375 | - ], | |
| 376 | - 'default' => [ | |
| 377 | - 'unit' => 'px', | |
| 378 | - 'size' => 0, | |
| 379 | - ], | |
| 380 | - 'selectors' => [ | |
| 381 | - self::$selectors['review_input_border_radius'] => 'border-radius: {{SIZE}}{{UNIT}};', | |
| 382 | - ], | |
| 383 | - ], | |
| 384 | - 'review_input_padding' => [ | |
| 385 | - 'label' => esc_html__( 'Inputs Padding (px)', 'shopbuilder' ), | |
| 386 | - 'type' => 'dimensions', | |
| 387 | - 'mode' => 'responsive', | |
| 388 | - 'size_units' => [ 'px' ], | |
| 389 | - 'selectors' => [ | |
| 390 | - self::$selectors['review_input_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 391 | - ], | |
| 392 | - ], | |
| 393 | - 'review_form_section_end' => [ | |
| 394 | - 'mode' => 'section_end', | |
| 395 | - ], | |
| 396 | - ]; | |
| 397 | - return $fields; | |
| 398 | - } | |
| 399 | - /** | |
| 400 | - * Widget Field | |
| 401 | - * | |
| 402 | - * @return array | |
| 403 | - */ | |
| 404 | - public static function heading_controls() { | |
| 405 | - $fields = [ | |
| 406 | - 'heading_section_start' => [ | |
| 407 | - 'mode' => 'section_start', | |
| 408 | - 'label' => esc_html__( 'Review Heading', 'shopbuilder' ), | |
| 409 | - 'tab' => 'style', | |
| 410 | - ], | |
| 411 | - 'review_heading_typography' => [ | |
| 412 | - 'mode' => 'group', | |
| 413 | - 'type' => 'typography', | |
| 414 | - 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 415 | - 'selector' => self::$selectors['review_heading_typography'], | |
| 416 | - 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude | |
| 417 | - ], | |
| 418 | - 'review_heading_color' => [ | |
| 419 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 420 | - 'type' => 'color', | |
| 421 | - | |
| 422 | - 'selectors' => [ | |
| 423 | - self::$selectors['review_heading_color'] => 'color: {{VALUE}};', | |
| 424 | - ], | |
| 425 | - ], | |
| 426 | - 'review_title_margin' => [ | |
| 427 | - 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 428 | - 'type' => 'dimensions', | |
| 429 | - 'mode' => 'responsive', | |
| 430 | - 'size_units' => [ 'px' ], | |
| 431 | - 'selectors' => [ | |
| 432 | - self::$selectors['review_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;', | |
| 433 | - ], | |
| 434 | - 'separator' => 'before', | |
| 435 | - ], | |
| 436 | - 'heading_section_end' => [ | |
| 437 | - 'mode' => 'section_end', | |
| 438 | - ], | |
| 439 | - ]; | |
| 440 | - return $fields; | |
| 441 | - } | |
| 442 | - /** | |
| 443 | - * Widget Field | |
| 444 | - * | |
| 445 | - * @return array | |
| 446 | - */ | |
| 447 | - public static function review_style() { | |
| 448 | - $fields = [ | |
| 449 | - 'review_style_start' => [ | |
| 450 | - 'mode' => 'section_start', | |
| 451 | - 'label' => esc_html__( 'Review Style', 'shopbuilder' ), | |
| 452 | - 'tab' => 'style', | |
| 453 | - ], | |
| 454 | - 'review_meta_color' => [ | |
| 455 | - 'label' => esc_html__( 'Meta Color', 'shopbuilder' ), | |
| 456 | - 'type' => 'color', | |
| 457 | - 'separator' => 'default', | |
| 458 | - 'description' => esc_html__( 'Date, Author', 'shopbuilder' ), | |
| 459 | - 'selectors' => [ | |
| 460 | - self::$selectors['review_meta_color'] => 'color: {{VALUE}};', | |
| 461 | - ], | |
| 462 | - ], | |
| 463 | - 'description_color' => [ | |
| 464 | - 'label' => esc_html__( 'Description Color', 'shopbuilder' ), | |
| 465 | - 'type' => 'color', | |
| 466 | - 'selectors' => [ | |
| 467 | - self::$selectors['description_color'] => 'color: {{VALUE}};', | |
| 468 | - ], | |
| 469 | - ], | |
| 470 | - 'review_border' => [ | |
| 471 | - 'mode' => 'group', | |
| 472 | - 'type' => 'border', | |
| 473 | - 'selector' => self::$selectors['review_border'], | |
| 474 | - 'size_units' => [ 'px' ], | |
| 475 | - ], | |
| 476 | - 'review_meta_typography' => [ | |
| 477 | - 'mode' => 'group', | |
| 478 | - 'type' => 'typography', | |
| 479 | - 'label' => esc_html__( 'Meta Typography', 'shopbuilder' ), | |
| 480 | - 'selector' => self::$selectors['review_meta_typography'], | |
| 481 | - 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude | |
| 482 | - ], | |
| 483 | - 'review_desc_typography' => [ | |
| 484 | - 'mode' => 'group', | |
| 485 | - 'type' => 'typography', | |
| 486 | - 'label' => esc_html__( 'Description Typography', 'shopbuilder' ), | |
| 487 | - 'selector' => self::$selectors['review_desc_typography'], | |
| 488 | - 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude | |
| 489 | - ], | |
| 490 | - 'review_padding' => [ | |
| 491 | - 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), | |
| 492 | - 'type' => 'dimensions', | |
| 493 | - 'mode' => 'responsive', | |
| 494 | - 'size_units' => [ 'px' ], | |
| 495 | - 'selectors' => [ | |
| 496 | - self::$selectors['review_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 497 | - ], | |
| 498 | - 'separator' => 'before', | |
| 499 | - ], | |
| 500 | - 'review_single_spacing' => [ | |
| 501 | - 'label' => esc_html__( 'Single Review Spacing (px)', 'shopbuilder' ), | |
| 502 | - 'type' => 'slider', | |
| 503 | - 'size_units' => [ 'px' ], | |
| 504 | - 'range' => [ | |
| 505 | - 'px' => [ | |
| 506 | - 'min' => 0, | |
| 507 | - 'max' => 100, | |
| 508 | - 'step' => 1, | |
| 509 | - ], | |
| 510 | - ], | |
| 511 | - 'selectors' => [ | |
| 512 | - self::$selectors['review_single_spacing'] => 'margin-bottom: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', | |
| 513 | - ], | |
| 514 | - 'separator' => 'before', | |
| 515 | - ], | |
| 516 | - 'review_style_end' => [ | |
| 517 | - 'mode' => 'section_end', | |
| 518 | - ], | |
| 519 | - ]; | |
| 520 | - return $fields; | |
| 521 | - } | |
| 522 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Main ReviewsSettings 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\Elementor\Helper\ControlHelper; | |
| 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 Review Settings class | |
| 20 | + */ | |
| 21 | +class ReviewsSettings { | |
| 22 | + /** | |
| 23 | + * Widget Control Selectors | |
| 24 | + * | |
| 25 | + * @var array | |
| 26 | + */ | |
| 27 | + private static $widget; | |
| 28 | + /** | |
| 29 | + * Widget Control Selectors | |
| 30 | + * | |
| 31 | + * @var array | |
| 32 | + */ | |
| 33 | + private static $selectors = []; | |
| 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 | + $fields = self::heading_controls() + | |
| 43 | + self::review_style() + | |
| 44 | + ReviewsStarSettings::widget_fields( $widget ) + | |
| 45 | + self::review_form() + | |
| 46 | + self::form_button(); | |
| 47 | + return $fields; | |
| 48 | + } | |
| 49 | + /** | |
| 50 | + * Widget Field | |
| 51 | + * | |
| 52 | + * @return array | |
| 53 | + */ | |
| 54 | + public static function form_button() { | |
| 55 | + $alignment = ControlHelper::alignment(); | |
| 56 | + unset( $alignment['justify'] ); | |
| 57 | + $fields = [ | |
| 58 | + 'button_section_start' => [ | |
| 59 | + 'mode' => 'section_start', | |
| 60 | + 'label' => esc_html__( 'Button', 'shopbuilder' ), | |
| 61 | + 'tab' => 'style', | |
| 62 | + ], | |
| 63 | + 'button_typography' => [ | |
| 64 | + 'mode' => 'group', | |
| 65 | + 'type' => 'typography', | |
| 66 | + 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 67 | + 'selector' => self::$selectors['button_typography'], | |
| 68 | + ], | |
| 69 | + 'submit_button_alignment' => [ | |
| 70 | + 'label' => esc_html__( 'Alignment', 'shopbuilder' ), | |
| 71 | + 'type' => 'choose', | |
| 72 | + 'options' => $alignment, | |
| 73 | + 'default' => 'left', | |
| 74 | + 'selectors' => [ | |
| 75 | + self::$selectors['submit_button_alignment']['text-align'] => 'text-align: {{VALUE}} !important;', | |
| 76 | + self::$selectors['submit_button_alignment']['float'] => 'float: none;', | |
| 77 | + ], | |
| 78 | + ], | |
| 79 | + | |
| 80 | + 'button_tabs_start' => [ | |
| 81 | + 'mode' => 'tabs_start', | |
| 82 | + ], | |
| 83 | + // Tab For normal view. | |
| 84 | + 'button_normal' => [ | |
| 85 | + 'mode' => 'tab_start', | |
| 86 | + 'label' => esc_html__( 'Normal', 'shopbuilder' ), | |
| 87 | + ], | |
| 88 | + 'button_text_color_normal' => [ | |
| 89 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 90 | + 'type' => 'color', | |
| 91 | + | |
| 92 | + 'separator' => 'default', | |
| 93 | + 'selectors' => [ | |
| 94 | + self::$selectors['button_text_color_normal'] => 'color: {{VALUE}};', | |
| 95 | + ], | |
| 96 | + ], | |
| 97 | + 'button_bg_color_normal' => [ | |
| 98 | + 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 99 | + 'type' => 'color', | |
| 100 | + 'alpha' => true, | |
| 101 | + 'selectors' => [ | |
| 102 | + self::$selectors['button_bg_color_normal'] => 'background-color: {{VALUE}};', | |
| 103 | + ], | |
| 104 | + ], | |
| 105 | + 'button_border' => [ | |
| 106 | + 'mode' => 'group', | |
| 107 | + 'type' => 'border', | |
| 108 | + 'selector' => self::$selectors['button_border'], | |
| 109 | + 'size_units' => [ 'px' ], | |
| 110 | + ], | |
| 111 | + 'button_normal_end' => [ | |
| 112 | + 'mode' => 'tab_end', | |
| 113 | + ], | |
| 114 | + 'button_hover' => [ | |
| 115 | + 'mode' => 'tab_start', | |
| 116 | + 'label' => esc_html__( 'Hover', 'shopbuilder' ), | |
| 117 | + ], | |
| 118 | + 'button_text_color_hover' => [ | |
| 119 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 120 | + 'type' => 'color', | |
| 121 | + | |
| 122 | + 'separator' => 'default', | |
| 123 | + 'selectors' => [ | |
| 124 | + self::$selectors['button_text_color_hover'] => 'color: {{VALUE}};', | |
| 125 | + ], | |
| 126 | + ], | |
| 127 | + 'button_bg_color_hover' => [ | |
| 128 | + 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 129 | + 'type' => 'color', | |
| 130 | + 'alpha' => true, | |
| 131 | + 'selectors' => [ | |
| 132 | + self::$selectors['button_bg_color_hover'] => 'background-color: {{VALUE}};', | |
| 133 | + ], | |
| 134 | + ], | |
| 135 | + 'button_border_hover_color' => [ | |
| 136 | + 'label' => esc_html__( 'Border Color', 'shopbuilder' ), | |
| 137 | + 'type' => 'color', | |
| 138 | + | |
| 139 | + 'selectors' => [ | |
| 140 | + self::$selectors['button_border_hover_color'] => 'border-color: {{VALUE}};', | |
| 141 | + ], | |
| 142 | + ], | |
| 143 | + 'button_hover_end' => [ | |
| 144 | + 'mode' => 'tab_end', | |
| 145 | + ], | |
| 146 | + 'button_tabs_end' => [ | |
| 147 | + 'mode' => 'tabs_end', | |
| 148 | + ], | |
| 149 | + 'button_border_radius' => [ | |
| 150 | + 'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), | |
| 151 | + 'type' => 'dimensions', | |
| 152 | + 'size_units' => [ 'px' ], | |
| 153 | + // 'separator' => 'before', | |
| 154 | + 'selectors' => [ | |
| 155 | + self::$selectors['button_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 156 | + ], | |
| 157 | + ], | |
| 158 | + 'button_padding' => [ | |
| 159 | + 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), | |
| 160 | + 'type' => 'dimensions', | |
| 161 | + 'size_units' => [ 'px' ], | |
| 162 | + 'selectors' => [ | |
| 163 | + self::$selectors['button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 164 | + ], | |
| 165 | + 'separator' => 'before', | |
| 166 | + ], | |
| 167 | + 'button_margin' => [ | |
| 168 | + 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 169 | + 'type' => 'dimensions', | |
| 170 | + 'size_units' => [ 'px' ], | |
| 171 | + 'selectors' => [ | |
| 172 | + self::$selectors['button_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 173 | + ], | |
| 174 | + ], | |
| 175 | + 'butotn_section_end' => [ | |
| 176 | + 'mode' => 'section_end', | |
| 177 | + ], | |
| 178 | + ]; | |
| 179 | + return $fields; | |
| 180 | + } | |
| 181 | + /** | |
| 182 | + * Widget Field | |
| 183 | + * | |
| 184 | + * @return array | |
| 185 | + */ | |
| 186 | + public static function review_form() { | |
| 187 | + $fields = [ | |
| 188 | + 'form_section_start' => [ | |
| 189 | + 'mode' => 'section_start', | |
| 190 | + 'label' => esc_html__( 'Review Form Heading', 'shopbuilder' ), | |
| 191 | + 'tab' => 'style', | |
| 192 | + ], | |
| 193 | + 'form_heading_typography' => [ | |
| 194 | + 'mode' => 'group', | |
| 195 | + 'type' => 'typography', | |
| 196 | + 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 197 | + 'selector' => self::$selectors['form_heading_typography'], | |
| 198 | + 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], | |
| 199 | + ], | |
| 200 | + 'form_heading_color' => [ | |
| 201 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 202 | + 'type' => 'color', | |
| 203 | + 'selectors' => [ | |
| 204 | + self::$selectors['form_heading_color'] => 'color: {{VALUE}};', | |
| 205 | + ], | |
| 206 | + ], | |
| 207 | + 'form_title_margin' => [ | |
| 208 | + 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 209 | + 'type' => 'dimensions', | |
| 210 | + 'size_units' => [ 'px' ], | |
| 211 | + 'selectors' => [ | |
| 212 | + self::$selectors['form_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;', | |
| 213 | + ], | |
| 214 | + 'separator' => 'before', | |
| 215 | + ], | |
| 216 | + 'formheading_section_end' => [ | |
| 217 | + 'mode' => 'section_end', | |
| 218 | + ], | |
| 219 | + 'review_form_section_start' => [ | |
| 220 | + 'mode' => 'section_start', | |
| 221 | + 'label' => esc_html__( 'Review From', 'shopbuilder' ), | |
| 222 | + 'tab' => 'style', | |
| 223 | + ], | |
| 224 | + 'review_label_heading' => [ | |
| 225 | + 'type' => 'html', | |
| 226 | + 'raw' => sprintf( | |
| 227 | + '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 228 | + esc_html__( 'Input Label', 'shopbuilder' ) | |
| 229 | + ), | |
| 230 | + 'content_classes' => 'elementor-panel-heading-title', | |
| 231 | + 'separator' => 'default', | |
| 232 | + ], | |
| 233 | + 'input_label_typography' => [ | |
| 234 | + 'mode' => 'group', | |
| 235 | + 'type' => 'typography', | |
| 236 | + 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 237 | + 'selector' => self::$selectors['input_label_typography'], | |
| 238 | + 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], | |
| 239 | + ], | |
| 240 | + 'review_label_color' => [ | |
| 241 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 242 | + 'type' => 'color', | |
| 243 | + 'selectors' => [ | |
| 244 | + self::$selectors['review_label_color'] => 'color: {{VALUE}} ', | |
| 245 | + ], | |
| 246 | + ], | |
| 247 | + 'review_label_required' => [ | |
| 248 | + 'label' => esc_html__( 'Required Color', 'shopbuilder' ), | |
| 249 | + 'type' => 'color', | |
| 250 | + 'selectors' => [ | |
| 251 | + self::$selectors['review_label_required'] => 'color: {{VALUE}}', | |
| 252 | + ], | |
| 253 | + ], | |
| 254 | + 'review_input_heading' => [ | |
| 255 | + 'type' => 'html', | |
| 256 | + 'raw' => sprintf( | |
| 257 | + '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 258 | + esc_html__( 'Form Input', 'shopbuilder' ) | |
| 259 | + ), | |
| 260 | + 'content_classes' => 'elementor-panel-heading-title', | |
| 261 | + 'separator' => 'before', | |
| 262 | + ], | |
| 263 | + 'label_input_text_typography' => [ | |
| 264 | + 'mode' => 'group', | |
| 265 | + 'type' => 'typography', | |
| 266 | + 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 267 | + 'selector' => self::$selectors['label_input_text_typography'], | |
| 268 | + 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], | |
| 269 | + ], | |
| 270 | + 'review_input_color' => [ | |
| 271 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 272 | + 'type' => 'color', | |
| 273 | + // 'separator' => 'default', | |
| 274 | + 'selectors' => [ | |
| 275 | + self::$selectors['review_input_color'] => 'color: {{VALUE}};', | |
| 276 | + ], | |
| 277 | + ], | |
| 278 | + 'review_input_border_color' => [ | |
| 279 | + 'label' => esc_html__( 'Border Color', 'shopbuilder' ), | |
| 280 | + 'type' => 'color', | |
| 281 | + 'selectors' => [ | |
| 282 | + self::$selectors['review_input_border_color'] => 'border-color: {{VALUE}};', | |
| 283 | + ], | |
| 284 | + ], | |
| 285 | + 'review_input_border_color_focus' => [ | |
| 286 | + 'label' => esc_html__( 'Focus Border Color', 'shopbuilder' ), | |
| 287 | + 'type' => 'color', | |
| 288 | + 'selectors' => [ | |
| 289 | + self::$selectors['review_input_border_color_focus'] => 'border-color: {{VALUE}} !important;outline-color: {{VALUE}} !important;', | |
| 290 | + ], | |
| 291 | + ], | |
| 292 | + 'review_comment_field_height' => [ | |
| 293 | + 'mode' => 'responsive', | |
| 294 | + 'label' => esc_html__( 'Comment field height (px)', 'shopbuilder' ), | |
| 295 | + 'type' => 'slider', | |
| 296 | + 'size_units' => [ 'px' ], | |
| 297 | + 'range' => [ | |
| 298 | + 'px' => [ | |
| 299 | + 'min' => 50, | |
| 300 | + 'max' => 300, | |
| 301 | + 'step' => 1, | |
| 302 | + ], | |
| 303 | + ], | |
| 304 | + 'default' => [ | |
| 305 | + 'unit' => 'px', | |
| 306 | + 'size' => 100, | |
| 307 | + ], | |
| 308 | + 'selectors' => [ | |
| 309 | + self::$selectors['review_comment_field_height'] => 'height: {{SIZE}}{{UNIT}};', | |
| 310 | + ], | |
| 311 | + ], | |
| 312 | + 'review_form_rating_size' => [ | |
| 313 | + 'mode' => 'responsive', | |
| 314 | + 'label' => esc_html__( 'Rating icon size (px)', 'shopbuilder' ), | |
| 315 | + 'type' => 'slider', | |
| 316 | + 'size_units' => [ 'px' ], | |
| 317 | + 'range' => [ | |
| 318 | + 'px' => [ | |
| 319 | + 'min' => 10, | |
| 320 | + 'max' => 100, | |
| 321 | + 'step' => 1, | |
| 322 | + ], | |
| 323 | + ], | |
| 324 | + 'selectors' => [ | |
| 325 | + self::$selectors['review_form_rating_size'] => 'font-size: {{SIZE}}{{UNIT}};', | |
| 326 | + ], | |
| 327 | + ], | |
| 328 | + 'review_field_spacing' => [ | |
| 329 | + 'label' => esc_html__( 'Field Spacing (px)', 'shopbuilder' ), | |
| 330 | + 'type' => 'slider', | |
| 331 | + 'size_units' => [ 'px' ], | |
| 332 | + 'range' => [ | |
| 333 | + 'px' => [ | |
| 334 | + 'min' => 0, | |
| 335 | + 'max' => 100, | |
| 336 | + 'step' => 1, | |
| 337 | + ], | |
| 338 | + ], | |
| 339 | + 'default' => [ | |
| 340 | + 'unit' => 'px', | |
| 341 | + 'size' => 15, | |
| 342 | + ], | |
| 343 | + 'selectors' => [ | |
| 344 | + self::$selectors['review_field_spacing']['margin-0'] => 'margin: 0;', | |
| 345 | + self::$selectors['review_field_spacing']['margin-buttom'] => 'margin-bottom: {{SIZE}}{{UNIT}}!important;', | |
| 346 | + ], | |
| 347 | + ], | |
| 348 | + 'review_input_border_radius' => [ | |
| 349 | + 'label' => esc_html__( 'Inputs Border Radius (px)', 'shopbuilder' ), | |
| 350 | + 'type' => 'slider', | |
| 351 | + 'size_units' => [ 'px' ], | |
| 352 | + 'range' => [ | |
| 353 | + 'px' => [ | |
| 354 | + 'min' => 0, | |
| 355 | + 'max' => 100, | |
| 356 | + 'step' => 1, | |
| 357 | + ], | |
| 358 | + ], | |
| 359 | + 'default' => [ | |
| 360 | + 'unit' => 'px', | |
| 361 | + 'size' => 0, | |
| 362 | + ], | |
| 363 | + 'selectors' => [ | |
| 364 | + self::$selectors['review_input_border_radius'] => 'border-radius: {{SIZE}}{{UNIT}};', | |
| 365 | + ], | |
| 366 | + ], | |
| 367 | + 'review_input_padding' => [ | |
| 368 | + 'label' => esc_html__( 'Inputs Padding (px)', 'shopbuilder' ), | |
| 369 | + 'type' => 'dimensions', | |
| 370 | + 'size_units' => [ 'px' ], | |
| 371 | + 'selectors' => [ | |
| 372 | + self::$selectors['review_input_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 373 | + ], | |
| 374 | + ], | |
| 375 | + 'review_form_section_end' => [ | |
| 376 | + 'mode' => 'section_end', | |
| 377 | + ], | |
| 378 | + ]; | |
| 379 | + return $fields; | |
| 380 | + } | |
| 381 | + /** | |
| 382 | + * Widget Field | |
| 383 | + * | |
| 384 | + * @return array | |
| 385 | + */ | |
| 386 | + public static function heading_controls() { | |
| 387 | + $fields = [ | |
| 388 | + 'heading_section_start' => [ | |
| 389 | + 'mode' => 'section_start', | |
| 390 | + 'label' => esc_html__( 'Review Heading', 'shopbuilder' ), | |
| 391 | + 'tab' => 'style', | |
| 392 | + ], | |
| 393 | + 'review_heading_typography' => [ | |
| 394 | + 'mode' => 'group', | |
| 395 | + 'type' => 'typography', | |
| 396 | + 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 397 | + 'selector' => self::$selectors['review_heading_typography'], | |
| 398 | + 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], | |
| 399 | + ], | |
| 400 | + 'review_heading_color' => [ | |
| 401 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 402 | + 'type' => 'color', | |
| 403 | + | |
| 404 | + 'selectors' => [ | |
| 405 | + self::$selectors['review_heading_color'] => 'color: {{VALUE}};', | |
| 406 | + ], | |
| 407 | + ], | |
| 408 | + 'review_title_margin' => [ | |
| 409 | + 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 410 | + 'type' => 'dimensions', | |
| 411 | + 'size_units' => [ 'px' ], | |
| 412 | + 'selectors' => [ | |
| 413 | + self::$selectors['review_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;', | |
| 414 | + ], | |
| 415 | + 'separator' => 'before', | |
| 416 | + ], | |
| 417 | + 'heading_section_end' => [ | |
| 418 | + 'mode' => 'section_end', | |
| 419 | + ], | |
| 420 | + ]; | |
| 421 | + return $fields; | |
| 422 | + } | |
| 423 | + /** | |
| 424 | + * Widget Field | |
| 425 | + * | |
| 426 | + * @return array | |
| 427 | + */ | |
| 428 | + public static function review_style() { | |
| 429 | + $fields = [ | |
| 430 | + 'review_style_start' => [ | |
| 431 | + 'mode' => 'section_start', | |
| 432 | + 'label' => esc_html__( 'Review Style', 'shopbuilder' ), | |
| 433 | + 'tab' => 'style', | |
| 434 | + ], | |
| 435 | + 'review_meta_color' => [ | |
| 436 | + 'label' => esc_html__( 'Meta Color', 'shopbuilder' ), | |
| 437 | + 'type' => 'color', | |
| 438 | + 'separator' => 'default', | |
| 439 | + 'description' => esc_html__( 'Date, Author', 'shopbuilder' ), | |
| 440 | + 'selectors' => [ | |
| 441 | + self::$selectors['review_meta_color'] => 'color: {{VALUE}};', | |
| 442 | + ], | |
| 443 | + ], | |
| 444 | + 'description_color' => [ | |
| 445 | + 'label' => esc_html__( 'Description Color', 'shopbuilder' ), | |
| 446 | + 'type' => 'color', | |
| 447 | + 'selectors' => [ | |
| 448 | + self::$selectors['description_color'] => 'color: {{VALUE}};', | |
| 449 | + ], | |
| 450 | + ], | |
| 451 | + 'review_border' => [ | |
| 452 | + 'mode' => 'group', | |
| 453 | + 'type' => 'border', | |
| 454 | + 'selector' => self::$selectors['review_border'], | |
| 455 | + 'size_units' => [ 'px' ], | |
| 456 | + ], | |
| 457 | + 'review_meta_typography' => [ | |
| 458 | + 'mode' => 'group', | |
| 459 | + 'type' => 'typography', | |
| 460 | + 'label' => esc_html__( 'Meta Typography', 'shopbuilder' ), | |
| 461 | + 'selector' => self::$selectors['review_meta_typography'], | |
| 462 | + 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], | |
| 463 | + ], | |
| 464 | + 'review_desc_typography' => [ | |
| 465 | + 'mode' => 'group', | |
| 466 | + 'type' => 'typography', | |
| 467 | + 'label' => esc_html__( 'Description Typography', 'shopbuilder' ), | |
| 468 | + 'selector' => self::$selectors['review_desc_typography'], | |
| 469 | + 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], | |
| 470 | + ], | |
| 471 | + 'review_padding' => [ | |
| 472 | + 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), | |
| 473 | + 'type' => 'dimensions', | |
| 474 | + 'size_units' => [ 'px' ], | |
| 475 | + 'selectors' => [ | |
| 476 | + self::$selectors['review_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 477 | + ], | |
| 478 | + 'separator' => 'before', | |
| 479 | + ], | |
| 480 | + 'review_single_spacing' => [ | |
| 481 | + 'label' => esc_html__( 'Single Review Spacing (px)', 'shopbuilder' ), | |
| 482 | + 'type' => 'slider', | |
| 483 | + 'size_units' => [ 'px' ], | |
| 484 | + 'range' => [ | |
| 485 | + 'px' => [ | |
| 486 | + 'min' => 0, | |
| 487 | + 'max' => 100, | |
| 488 | + 'step' => 1, | |
| 489 | + ], | |
| 490 | + ], | |
| 491 | + 'selectors' => [ | |
| 492 | + self::$selectors['review_single_spacing'] => 'margin-bottom: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', | |
| 493 | + ], | |
| 494 | + 'separator' => 'before', | |
| 495 | + ], | |
| 496 | + 'review_style_end' => [ | |
| 497 | + 'mode' => 'section_end', | |
| 498 | + ], | |
| 499 | + ]; | |
| 500 | + return $fields; | |
| 501 | + } | |
| 502 | + | |
| 503 | +} | |