product-review.php
869 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use ShopEngine\Widgets\Products; |
| 8 | |
| 9 | class ShopEngine_Product_Review extends \ShopEngine\Base\Widget |
| 10 | { |
| 11 | |
| 12 | public function config() { |
| 13 | return new ShopEngine_Product_Review_Config(); |
| 14 | } |
| 15 | |
| 16 | protected function register_controls() { |
| 17 | |
| 18 | /* |
| 19 | --------------------------- |
| 20 | review heading |
| 21 | --------------------------- |
| 22 | */ |
| 23 | |
| 24 | $this->start_controls_section( |
| 25 | 'shopengine_section_product_review_heading', |
| 26 | [ |
| 27 | 'label' => esc_html__('Heading', 'shopengine'), |
| 28 | 'tab' => Controls_Manager::TAB_STYLE, |
| 29 | ] |
| 30 | ); |
| 31 | |
| 32 | $this->add_control( |
| 33 | 'shopengine_product_review_heading_color', |
| 34 | [ |
| 35 | 'label' => esc_html__('Color', 'shopengine'), |
| 36 | 'type' => Controls_Manager::COLOR, |
| 37 | 'default' => '#101010', |
| 38 | 'alpha' => false, |
| 39 | 'selectors' => [ |
| 40 | '{{WRAPPER}} .shopengine-product-review :is(#reviews #comments .woocommerce-Reviews-title, #review_form .comment-reply-title)' => 'color: {{VALUE}};', |
| 41 | ], |
| 42 | ] |
| 43 | ); |
| 44 | |
| 45 | $this->add_group_control( |
| 46 | Group_Control_Typography::get_type(), |
| 47 | [ |
| 48 | 'name' => 'shopengine_product_review_heading_typography', |
| 49 | 'label' => esc_html__('Typography', 'shopengine'), |
| 50 | 'selector' => '{{WRAPPER}} .shopengine-product-review :is(#reviews #comments .woocommerce-Reviews-title, #review_form .comment-reply-title)', |
| 51 | 'exclude' => ['font_family', 'text_decoration', 'font_style'], |
| 52 | 'fields_options' => [ |
| 53 | 'typography' => [ |
| 54 | 'default' => 'custom', |
| 55 | ], |
| 56 | 'font_weight' => [ |
| 57 | 'default' => '600', |
| 58 | ], |
| 59 | 'font_size' => [ |
| 60 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 61 | 'default' => [ |
| 62 | 'size' => '18', |
| 63 | 'unit' => 'px', |
| 64 | ], |
| 65 | 'size_units' => ['px'], |
| 66 | ], |
| 67 | 'text_transform' => [ |
| 68 | 'default' => 'uppercase', |
| 69 | ], |
| 70 | 'line_height' => [ |
| 71 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 72 | 'default' => [ |
| 73 | 'size' => '22', |
| 74 | 'unit' => 'px', |
| 75 | ], |
| 76 | 'size_units' => ['px'], |
| 77 | 'tablet_default' => [ |
| 78 | 'unit' => 'px', |
| 79 | ], |
| 80 | 'mobile_default' => [ |
| 81 | 'unit' => 'px', |
| 82 | ], |
| 83 | ], |
| 84 | 'letter_spacing' => [ |
| 85 | 'label' => esc_html__('Letter Spacing (px)', 'shopengine'), |
| 86 | 'default' => [ |
| 87 | 'size' => '0.1', |
| 88 | ], |
| 89 | 'size_units' => ['px'], |
| 90 | ], |
| 91 | ], |
| 92 | ] |
| 93 | ); |
| 94 | |
| 95 | $this->add_responsive_control( |
| 96 | 'shopengine_product_review_title_margin', |
| 97 | [ |
| 98 | 'label' => esc_html__( 'Margin (px)', 'shopengine' ), |
| 99 | 'type' => Controls_Manager::DIMENSIONS, |
| 100 | 'size_units' => ['px'], |
| 101 | 'default' => [ |
| 102 | 'top' => '0', |
| 103 | 'right' => '0', |
| 104 | 'bottom' => '15', |
| 105 | 'left' => '0', |
| 106 | 'unit' => 'px', |
| 107 | 'isLinked' => false, |
| 108 | ], |
| 109 | 'selectors' => [ |
| 110 | '{{WRAPPER}} .shopengine-product-review :is(#reviews #comments .woocommerce-Reviews-title, #review_form .comment-reply-title)' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;', |
| 111 | '.rtl {{WRAPPER}} .shopengine-product-review :is(#reviews #comments .woocommerce-Reviews-title, #review_form .comment-reply-title)' => 'margin: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}; padding: 0;', |
| 112 | ], |
| 113 | 'separator' => 'before', |
| 114 | ] |
| 115 | ); |
| 116 | |
| 117 | $this->end_controls_section(); |
| 118 | |
| 119 | /* |
| 120 | --------------------------- |
| 121 | review styles |
| 122 | --------------------------- |
| 123 | */ |
| 124 | |
| 125 | $this->start_controls_section( |
| 126 | 'shopengine_product_review_style', |
| 127 | [ |
| 128 | 'label' => esc_html__('Review Style', 'shopengine'), |
| 129 | 'tab' => Controls_Manager::TAB_STYLE, |
| 130 | ] |
| 131 | ); |
| 132 | |
| 133 | $this->add_control( |
| 134 | 'shopengine_product_review_rating_color', |
| 135 | [ |
| 136 | 'label' => esc_html__('Rating Color', 'shopengine'), |
| 137 | 'type' => Controls_Manager::COLOR, |
| 138 | 'default' => '#FEC42D', |
| 139 | 'alpha' => false, |
| 140 | 'selectors' => [ |
| 141 | '{{WRAPPER}} div.shopengine-product-review #reviews .star-rating' => 'color: {{VALUE}};', |
| 142 | '{{WRAPPER}} div.shopengine-product-review #reviews .star-rating span' => 'color: {{VALUE}};', |
| 143 | '{{WRAPPER}} div.shopengine-product-review #reviews .star-rating span::before' => 'color: {{VALUE}};', |
| 144 | '{{WRAPPER}} div.shopengine-product-review #reviews .star-rating::before' => 'color: {{VALUE}};', |
| 145 | '{{WRAPPER}} div.shopengine-product-review #reviews p.stars a' => 'color: {{VALUE}};', |
| 146 | '{{WRAPPER}} div.shopengine-product-review #reviews p.stars.selected a' => 'color: {{VALUE}};', |
| 147 | '{{WRAPPER}} div.shopengine-product-review #reviews p.stars:hover a' => 'color: {{VALUE}};', |
| 148 | '{{WRAPPER}} div.shopengine-product-review #reviews p.stars a::before' => 'color: {{VALUE}};', |
| 149 | '{{WRAPPER}} div.shopengine-product-review #reviews p.stars a.active~a::before' => 'color: {{VALUE}};', |
| 150 | '{{WRAPPER}} div.shopengine-product-review #reviews .se-rating-container .star-rating span' => 'color: {{VALUE}};', |
| 151 | '{{WRAPPER}} div.shopengine-product-review #reviews .se-rating-container .star-rating::before' => 'color: {{VALUE}};', |
| 152 | ], |
| 153 | ] |
| 154 | ); |
| 155 | |
| 156 | $this->add_control( |
| 157 | 'shopengine_product_review_date_color', |
| 158 | [ |
| 159 | 'label' => esc_html__('Date, Author and Description Color', 'shopengine'), |
| 160 | 'type' => Controls_Manager::COLOR, |
| 161 | 'default' => '#101010', |
| 162 | 'alpha' => false, |
| 163 | 'selectors' => [ |
| 164 | '{{WRAPPER}} div.shopengine-product-review :is(.woocommerce-review__published-date, .description p, .woocommerce-review__author, .woocommerce-review__verified, .woocommerce-review__dash)' => 'color: {{VALUE}};', |
| 165 | ], |
| 166 | ] |
| 167 | ); |
| 168 | |
| 169 | $this->add_control( |
| 170 | 'shopengine_product_review_separator_color', |
| 171 | [ |
| 172 | 'label' => esc_html__('Comment Separator Color', 'shopengine'), |
| 173 | 'type' => Controls_Manager::COLOR, |
| 174 | 'default' => '#EFEFEF', |
| 175 | 'alpha' => false, |
| 176 | 'selectors' => [ |
| 177 | '{{WRAPPER}} div.shopengine-product-review #reviews #comments .commentlist li' => 'border-color: {{VALUE}};', |
| 178 | ], |
| 179 | ] |
| 180 | ); |
| 181 | |
| 182 | $this->add_group_control( |
| 183 | Group_Control_Typography::get_type(), |
| 184 | [ |
| 185 | 'name' => 'shopengine_product_review_author_typography', |
| 186 | 'label' => esc_html__('Author Typography', 'shopengine'), |
| 187 | 'selector' => '{{WRAPPER}} div.shopengine-product-review .woocommerce-review__author', |
| 188 | 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'line_height', 'font_style', 'text_transform'], |
| 189 | 'fields_options' => [ |
| 190 | 'typography' => [ |
| 191 | 'default' => 'custom', |
| 192 | ], |
| 193 | 'font_weight' => [ |
| 194 | 'default' => '600', |
| 195 | ], |
| 196 | 'font_size' => [ |
| 197 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 198 | 'default' => [ |
| 199 | 'size' => '18', |
| 200 | 'unit' => 'px', |
| 201 | ], |
| 202 | 'size_units' => ['px'], |
| 203 | ], |
| 204 | ], |
| 205 | ] |
| 206 | ); |
| 207 | |
| 208 | $this->add_group_control( |
| 209 | Group_Control_Typography::get_type(), |
| 210 | [ |
| 211 | 'name' => 'shopengine_product_review_date_typography', |
| 212 | 'label' => esc_html__('Date Typography', 'shopengine'), |
| 213 | 'selector' => '{{WRAPPER}} div.shopengine-product-review :is(.woocommerce-review__published-date, .woocommerce-review__dash, .woocommerce-review__verified)', |
| 214 | 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'line_height', 'font_style', 'text_transform'], |
| 215 | 'fields_options' => [ |
| 216 | 'typography' => [ |
| 217 | 'default' => 'custom', |
| 218 | ], |
| 219 | 'font_weight' => [ |
| 220 | 'default' => '400', |
| 221 | ], |
| 222 | 'font_size' => [ |
| 223 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 224 | 'default' => [ |
| 225 | 'size' => '14', |
| 226 | 'unit' => 'px', |
| 227 | ], |
| 228 | 'size_units' => ['px'], |
| 229 | 'selectors' => [ |
| 230 | '{{WRAPPER}} div.shopengine-product-review :is(.woocommerce-review__published-date, .woocommerce-review__dash, .woocommerce-review__verified)' => 'font-size: {{SIZE}}{{UNIT}} !important', |
| 231 | ], |
| 232 | ], |
| 233 | ], |
| 234 | ] |
| 235 | ); |
| 236 | |
| 237 | $this->add_group_control( |
| 238 | Group_Control_Typography::get_type(), |
| 239 | [ |
| 240 | 'name' => 'shopengine_product_review_description_typography', |
| 241 | 'label' => esc_html__('Description Typography', 'shopengine'), |
| 242 | 'selector' => '{{WRAPPER}} div.shopengine-product-review .description p', |
| 243 | 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style', 'text_transform'], |
| 244 | 'fields_options' => [ |
| 245 | 'typography' => [ |
| 246 | 'default' => 'custom', |
| 247 | ], |
| 248 | 'font_weight' => [ |
| 249 | 'default' => '400', |
| 250 | ], |
| 251 | 'font_size' => [ |
| 252 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 253 | 'default' => [ |
| 254 | 'size' => '16', |
| 255 | 'unit' => 'px', |
| 256 | ], |
| 257 | 'size_units' => ['px'], |
| 258 | ], |
| 259 | 'line_height' => [ |
| 260 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 261 | 'default' => [ |
| 262 | 'size' => '28', |
| 263 | 'unit' => 'px', |
| 264 | ], |
| 265 | 'size_units' => ['px'], |
| 266 | 'tablet_default' => [ |
| 267 | 'unit' => 'px', |
| 268 | ], |
| 269 | 'mobile_default' => [ |
| 270 | 'unit' => 'px', |
| 271 | ], |
| 272 | ], |
| 273 | ], |
| 274 | ] |
| 275 | ); |
| 276 | |
| 277 | $this->add_control( |
| 278 | 'shopengine_product_review_single_spacing', |
| 279 | [ |
| 280 | 'label' => esc_html__('Single Review Spacing (px)', 'shopengine'), |
| 281 | 'type' => Controls_Manager::SLIDER, |
| 282 | 'size_units' => ['px'], |
| 283 | 'range' => [ |
| 284 | 'px' => [ |
| 285 | 'min' => 0, |
| 286 | 'max' => 100, |
| 287 | 'step' => 1, |
| 288 | ] |
| 289 | ], |
| 290 | 'default' => [ |
| 291 | 'unit' => 'px', |
| 292 | 'size' => 35, |
| 293 | ], |
| 294 | 'selectors' => [ |
| 295 | '{{WRAPPER}} div.shopengine-product-review #reviews #comments .commentlist li:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', |
| 296 | '{{WRAPPER}} div.shopengine-product-review #reviews #comments .commentlist li:last-child' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 297 | ], |
| 298 | 'separator' => 'before', |
| 299 | ] |
| 300 | ); |
| 301 | |
| 302 | $this->end_controls_section(); // end /review styles |
| 303 | |
| 304 | /* |
| 305 | --------------------------- |
| 306 | review form |
| 307 | --------------------------- |
| 308 | */ |
| 309 | |
| 310 | $this->start_controls_section( |
| 311 | 'shopengine_product_review_table', |
| 312 | [ |
| 313 | 'label' => esc_html__('Review Form', 'shopengine'), |
| 314 | 'tab' => Controls_Manager::TAB_STYLE, |
| 315 | ] |
| 316 | ); |
| 317 | |
| 318 | $this->add_control( |
| 319 | 'shopengine_product_review_label_heading', |
| 320 | [ |
| 321 | 'label' => esc_html__('Input Label', 'shopengine'), |
| 322 | 'type' => Controls_Manager::HEADING, |
| 323 | ] |
| 324 | ); |
| 325 | |
| 326 | $this->add_control( |
| 327 | 'shopengine_product_review_label_clr', |
| 328 | [ |
| 329 | 'label' => esc_html__('Color', 'shopengine'), |
| 330 | 'type' => Controls_Manager::COLOR, |
| 331 | 'default' => '#C9C9C9', |
| 332 | 'alpha' => false, |
| 333 | 'selectors' => [ |
| 334 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(label, .comment-notes)' => 'color: {{VALUE}} !important;', |
| 335 | ], |
| 336 | ] |
| 337 | ); |
| 338 | |
| 339 | $this->add_control( |
| 340 | 'shopengine_product_review_label_required', |
| 341 | [ |
| 342 | 'label' => esc_html__('Required Color', 'shopengine'), |
| 343 | 'type' => Controls_Manager::COLOR, |
| 344 | 'default' => '#EA4335', |
| 345 | 'alpha' => false, |
| 346 | 'selectors' => [ |
| 347 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .required' => 'color: {{VALUE}}', |
| 348 | ], |
| 349 | ] |
| 350 | ); |
| 351 | |
| 352 | $this->add_group_control( |
| 353 | Group_Control_Typography::get_type(), |
| 354 | [ |
| 355 | 'name' => 'shopengine_product_review_label_typography', |
| 356 | 'label' => esc_html__('Typography', 'shopengine'), |
| 357 | 'selector' => '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(label, .comment-notes)', |
| 358 | 'exclude' => ['font_family', 'text_decoration', 'font_style', 'text_transform'], |
| 359 | 'fields_options' => [ |
| 360 | 'typography' => [ |
| 361 | 'default' => 'custom', |
| 362 | ], |
| 363 | 'font_weight' => [ |
| 364 | 'default' => '400', |
| 365 | ], |
| 366 | 'font_size' => [ |
| 367 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 368 | 'default' => [ |
| 369 | 'size' => '14', |
| 370 | 'unit' => 'px', |
| 371 | ], |
| 372 | 'size_units' => ['px'], |
| 373 | ], |
| 374 | 'line_height' => [ |
| 375 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 376 | 'default' => [ |
| 377 | 'size' => '17', |
| 378 | 'unit' => 'px', |
| 379 | ], |
| 380 | 'size_units' => ['px'], |
| 381 | 'tablet_default' => [ |
| 382 | 'unit' => 'px', |
| 383 | ], |
| 384 | 'mobile_default' => [ |
| 385 | 'unit' => 'px', |
| 386 | ], |
| 387 | ], |
| 388 | 'letter_spacing' => [ |
| 389 | 'label' => esc_html__('Letter Spacing (px)', 'shopengine'), |
| 390 | 'default' => [ |
| 391 | 'size' => '0', |
| 392 | 'unit' => 'px', |
| 393 | ], |
| 394 | 'size_units' => ['px'], |
| 395 | ], |
| 396 | ], |
| 397 | ] |
| 398 | ); |
| 399 | |
| 400 | $this->add_control( |
| 401 | 'shopengine_product_review_input_heading', |
| 402 | [ |
| 403 | 'label' => esc_html__('Form Input', 'shopengine'), |
| 404 | 'type' => Controls_Manager::HEADING, |
| 405 | 'separator' => 'before', |
| 406 | ] |
| 407 | ); |
| 408 | |
| 409 | $this->add_control( |
| 410 | 'shopengine_product_review_input_clr', |
| 411 | [ |
| 412 | 'label' => esc_html__('Color', 'shopengine'), |
| 413 | 'type' => Controls_Manager::COLOR, |
| 414 | 'default' => '#101010', |
| 415 | 'alpha' => false, |
| 416 | 'selectors' => [ |
| 417 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(input:not([type=checkbox]), textarea)' => 'color: {{VALUE}};', |
| 418 | ], |
| 419 | ] |
| 420 | ); |
| 421 | |
| 422 | $this->add_control( |
| 423 | 'shopengine_product_review_input_border_clr', |
| 424 | [ |
| 425 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 426 | 'type' => Controls_Manager::COLOR, |
| 427 | 'default' => '#F2F2F2', |
| 428 | 'alpha' => false, |
| 429 | 'selectors' => [ |
| 430 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(textarea, input:not(.submit))' => 'border-color: {{VALUE}};', |
| 431 | ], |
| 432 | ] |
| 433 | ); |
| 434 | |
| 435 | $this->add_control( |
| 436 | 'shopengine_product_review_input_border_focus_clr', |
| 437 | [ |
| 438 | 'label' => esc_html__('Focus Border Color', 'shopengine'), |
| 439 | 'type' => Controls_Manager::COLOR, |
| 440 | 'default' => '#505255', |
| 441 | 'alpha' => false, |
| 442 | 'selectors' => [ |
| 443 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(textarea:focus, input:focus, .comment-form-cookies-consent input::after)' => 'border-color: {{VALUE}} !important;', |
| 444 | ], |
| 445 | ] |
| 446 | ); |
| 447 | |
| 448 | $this->add_group_control( |
| 449 | Group_Control_Typography::get_type(), |
| 450 | [ |
| 451 | 'name' => 'shopengine_review_label_input_typography', |
| 452 | 'label' => esc_html__('Typography', 'shopengine'), |
| 453 | 'selector' => '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(input:not([type=checkbox]), textarea)', |
| 454 | 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style', 'text_transform'], |
| 455 | 'fields_options' => [ |
| 456 | 'typography' => [ |
| 457 | 'default' => 'custom', |
| 458 | ], |
| 459 | 'font_weight' => [ |
| 460 | 'default' => '400', |
| 461 | ], |
| 462 | 'font_size' => [ |
| 463 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 464 | 'default' => [ |
| 465 | 'size' => '16', |
| 466 | 'unit' => 'px', |
| 467 | ], |
| 468 | 'size_units' => ['px'], |
| 469 | ], |
| 470 | 'line_height' => [ |
| 471 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 472 | 'default' => [ |
| 473 | 'size' => '19', |
| 474 | 'unit' => 'px', |
| 475 | ], |
| 476 | 'size_units' => ['px'], |
| 477 | 'tablet_default' => [ |
| 478 | 'unit' => 'px', |
| 479 | ], |
| 480 | 'mobile_default' => [ |
| 481 | 'unit' => 'px', |
| 482 | ], |
| 483 | ], |
| 484 | ], |
| 485 | ] |
| 486 | ); |
| 487 | |
| 488 | $this->add_control( |
| 489 | 'shopengine_product_review_field_spacing', |
| 490 | [ |
| 491 | 'label' => esc_html__('Field Spacing (px)', 'shopengine'), |
| 492 | 'type' => Controls_Manager::SLIDER, |
| 493 | 'size_units' => ['px'], |
| 494 | 'range' => [ |
| 495 | 'px' => [ |
| 496 | 'min' => 0, |
| 497 | 'max' => 100, |
| 498 | 'step' => 1, |
| 499 | ] |
| 500 | ], |
| 501 | 'default' => [ |
| 502 | 'unit' => 'px', |
| 503 | 'size' => 15, |
| 504 | ], |
| 505 | 'selectors' => [ |
| 506 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond :is(.comment-form)' => 'margin: 0;', |
| 507 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(.comment-notes, .comment-form-rating, .comment-form-comment, .comment-form-author, .comment-form-email, .comment-form-cookies-consent)' => 'margin: 0 0 {{SIZE}}{{UNIT}} 0;', |
| 508 | ], |
| 509 | 'separator' => 'before', |
| 510 | ] |
| 511 | ); |
| 512 | |
| 513 | $this->add_control( |
| 514 | 'shopengine_product_review_input_border_radius', |
| 515 | [ |
| 516 | 'label' => esc_html__('Inputs Border Radius (px)', 'shopengine'), |
| 517 | 'type' => Controls_Manager::SLIDER, |
| 518 | 'size_units' => ['px'], |
| 519 | 'range' => [ |
| 520 | 'px' => [ |
| 521 | 'min' => 0, |
| 522 | 'max' => 100, |
| 523 | 'step' => 1, |
| 524 | ] |
| 525 | ], |
| 526 | 'default' => [ |
| 527 | 'unit' => 'px', |
| 528 | 'size' => 0, |
| 529 | ], |
| 530 | 'selectors' => [ |
| 531 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(textarea, input)' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 532 | ], |
| 533 | 'separator' => 'before', |
| 534 | ] |
| 535 | ); |
| 536 | |
| 537 | $this->add_responsive_control( |
| 538 | 'shopengine_product_review_input_padding', |
| 539 | [ |
| 540 | 'label' => esc_html__('Inputs Padding (px)', 'shopengine'), |
| 541 | 'type' => Controls_Manager::DIMENSIONS, |
| 542 | 'size_units' => ['px'], |
| 543 | 'default' => [ |
| 544 | 'top' => '10', |
| 545 | 'right' => '10', |
| 546 | 'bottom' => '10', |
| 547 | 'left' => '10', |
| 548 | 'unit' => 'px', |
| 549 | 'isLinked' => true, |
| 550 | ], |
| 551 | 'selectors' => [ |
| 552 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(textarea, input:not(#wp-comment-cookies-consent, .submit))' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 553 | '.rtl {{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form :is(textarea, input:not(#wp-comment-cookies-consent, .submit))' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};', |
| 554 | ], |
| 555 | 'separator' => 'before', |
| 556 | ] |
| 557 | ); |
| 558 | |
| 559 | $this->end_controls_section(); // end /review form |
| 560 | |
| 561 | /* |
| 562 | --------------------------------- |
| 563 | submit button |
| 564 | ------------------------------------ |
| 565 | */ |
| 566 | |
| 567 | $this->start_controls_section( |
| 568 | 'shopengine_product_review_submit_button_section', |
| 569 | [ |
| 570 | 'label' => esc_html__('Submit Button', 'shopengine'), |
| 571 | 'tab' => Controls_Manager::TAB_STYLE, |
| 572 | ] |
| 573 | ); |
| 574 | |
| 575 | $this->add_group_control( |
| 576 | Group_Control_Typography::get_type(), |
| 577 | [ |
| 578 | 'name' => 'shopengine_product_review_submit_button_typography', |
| 579 | 'label' => esc_html__('Button Typography', 'shopengine'), |
| 580 | 'selector' => '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit', |
| 581 | 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style'], |
| 582 | 'fields_options' => [ |
| 583 | 'typography' => [ |
| 584 | 'default' => 'custom', |
| 585 | ], |
| 586 | 'font_weight' => [ |
| 587 | 'default' => '500', |
| 588 | ], |
| 589 | 'font_size' => [ |
| 590 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 591 | 'default' => [ |
| 592 | 'size' => '15', |
| 593 | 'unit' => 'px', |
| 594 | ], |
| 595 | 'size_units' => ['px'], |
| 596 | ], |
| 597 | 'line_height' => [ |
| 598 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 599 | 'default' => [ |
| 600 | 'size' => '19', |
| 601 | 'unit' => 'px', |
| 602 | ], |
| 603 | 'size_units' => ['px'], |
| 604 | 'tablet_default' => [ |
| 605 | 'unit' => 'px', |
| 606 | ], |
| 607 | 'mobile_default' => [ |
| 608 | 'unit' => 'px', |
| 609 | ], |
| 610 | ], |
| 611 | ], |
| 612 | ] |
| 613 | ); |
| 614 | |
| 615 | $this->add_responsive_control( |
| 616 | 'shopengine_product_review_submit_button_alignment', |
| 617 | [ |
| 618 | 'label' => esc_html__('Alignment', 'shopengine'), |
| 619 | 'type' => Controls_Manager::CHOOSE, |
| 620 | 'options' => [ |
| 621 | 'left' => [ |
| 622 | 'title' => esc_html__('Left', 'shopengine'), |
| 623 | 'icon' => 'eicon-text-align-left', |
| 624 | ], |
| 625 | 'center' => [ |
| 626 | 'title' => esc_html__('Center', 'shopengine'), |
| 627 | 'icon' => 'eicon-text-align-center', |
| 628 | ], |
| 629 | 'right' => [ |
| 630 | 'title' => esc_html__('Right', 'shopengine'), |
| 631 | 'icon' => 'eicon-text-align-right', |
| 632 | ], |
| 633 | ], |
| 634 | 'default' => 'left', |
| 635 | 'selectors' => [ |
| 636 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit' => 'text-align: {{VALUE}};', |
| 637 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'float: none;', |
| 638 | '.rtl {{WRAPPER}}.review_submit_button-align-left div.shopengine-product-review #review_form #respond .comment-form .form-submit' => 'text-align:right;', |
| 639 | '.rtl {{WRAPPER}}.review_submit_button-align-right div.shopengine-product-review #review_form #respond .comment-form .form-submit' => 'text-align:left;', |
| 640 | ], |
| 641 | 'prefix_class' => 'review_submit_button-align-', |
| 642 | ] |
| 643 | ); |
| 644 | |
| 645 | $this->start_controls_tabs( |
| 646 | 'shopengine_product_review_submit_button_tabs', |
| 647 | [ |
| 648 | 'separator' => 'before' |
| 649 | ] |
| 650 | ); |
| 651 | |
| 652 | $this->start_controls_tab( |
| 653 | 'shopengine_product_review_submit_button_tab_normal', |
| 654 | [ |
| 655 | 'label' => esc_html__('Normal', 'shopengine'), |
| 656 | ] |
| 657 | ); |
| 658 | |
| 659 | $this->add_control( |
| 660 | 'shopengine_product_review_submit_button_color', |
| 661 | [ |
| 662 | 'label' => esc_html__('Color', 'shopengine'), |
| 663 | 'type' => Controls_Manager::COLOR, |
| 664 | 'default' => '#fff', |
| 665 | 'alpha' => false, |
| 666 | 'selectors' => [ |
| 667 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'color: {{VALUE}} !important;', |
| 668 | ], |
| 669 | ] |
| 670 | ); |
| 671 | |
| 672 | $this->add_control( |
| 673 | 'shopengine_product_review_submit_button_bg', |
| 674 | [ |
| 675 | 'label' => esc_html__('Background', 'shopengine'), |
| 676 | 'type' => Controls_Manager::COLOR, |
| 677 | 'default' => '#3A3A3A', |
| 678 | 'alpha' => false, |
| 679 | 'selectors' => [ |
| 680 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'background-color: {{VALUE}} !important;', |
| 681 | ], |
| 682 | ] |
| 683 | ); |
| 684 | |
| 685 | $this->end_controls_tab(); |
| 686 | |
| 687 | $this->start_controls_tab( |
| 688 | 'shopengine_product_review_submit_button_tab_hover', |
| 689 | [ |
| 690 | 'label' => esc_html__('Hover', 'shopengine'), |
| 691 | ] |
| 692 | ); |
| 693 | |
| 694 | $this->add_control( |
| 695 | 'shopengine_product_review_submit_button_hover_color', |
| 696 | [ |
| 697 | 'label' => esc_html__('Color', 'shopengine'), |
| 698 | 'type' => Controls_Manager::COLOR, |
| 699 | 'alpha' => false, |
| 700 | 'default' => '#fff', |
| 701 | 'selectors' => [ |
| 702 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit:hover' => 'color: {{VALUE}} !important;', |
| 703 | ], |
| 704 | ] |
| 705 | ); |
| 706 | |
| 707 | $this->add_control( |
| 708 | 'shopengine_product_review_submit_button_hover_bg', |
| 709 | [ |
| 710 | 'label' => esc_html__('Background', 'shopengine'), |
| 711 | 'type' => Controls_Manager::COLOR, |
| 712 | 'default' => '#101010', |
| 713 | 'alpha' => false, |
| 714 | 'selectors' => [ |
| 715 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit:hover' => 'background-color: {{VALUE}} !important;', |
| 716 | ], |
| 717 | ] |
| 718 | ); |
| 719 | |
| 720 | $this->add_control( |
| 721 | 'shopengine_product_review_submit_button_hover_border_color', |
| 722 | [ |
| 723 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 724 | 'type' => Controls_Manager::COLOR, |
| 725 | 'default' => '#101010', |
| 726 | 'alpha' => false, |
| 727 | 'selectors' => [ |
| 728 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit:hover' => 'border-color: {{VALUE}};', |
| 729 | ], |
| 730 | ] |
| 731 | ); |
| 732 | |
| 733 | $this->end_controls_tab(); |
| 734 | $this->end_controls_tabs(); |
| 735 | |
| 736 | $this->add_group_control( |
| 737 | Group_Control_Border::get_type(), |
| 738 | [ |
| 739 | 'name' => 'shopengine_product_review_submit_button_border', |
| 740 | 'label' => esc_html__('Border (px)', 'shopengine'), |
| 741 | 'size_units' => ['px'], |
| 742 | 'fields_options' => [ |
| 743 | 'border' => [ |
| 744 | 'default' => 'solid', |
| 745 | ], |
| 746 | 'width' => [ |
| 747 | 'label' => esc_html__('Width (px)', 'shopengine'), |
| 748 | 'default' => [ |
| 749 | 'top' => '1', |
| 750 | 'right' => '1', |
| 751 | 'bottom' => '1', |
| 752 | 'left' => '1', |
| 753 | 'isLinked' => true, |
| 754 | ], |
| 755 | 'responsive' => false, |
| 756 | 'selectors' => [ |
| 757 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 758 | '.rtl {{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 759 | ], |
| 760 | ], |
| 761 | 'color' => [ |
| 762 | 'default' => '#3A3A3A', |
| 763 | 'alpha' => false, |
| 764 | ] |
| 765 | ], |
| 766 | 'selector' => '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit', |
| 767 | 'separator' => 'before' |
| 768 | ] |
| 769 | ); |
| 770 | |
| 771 | $this->add_control( |
| 772 | 'shopengine_product_review_submit_button_border_radius', |
| 773 | [ |
| 774 | 'label' => esc_html__('Border Radius (px)', 'shopengine'), |
| 775 | 'type' => Controls_Manager::DIMENSIONS, |
| 776 | 'size_units' => ['px'], |
| 777 | 'default' => [ |
| 778 | 'top' => '3', |
| 779 | 'right' => '3', |
| 780 | 'bottom' => '3', |
| 781 | 'left' => '3', |
| 782 | 'unit' => 'px', |
| 783 | 'isLinked' => true, |
| 784 | ], |
| 785 | 'selectors' => [ |
| 786 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 787 | '.rtl {{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 788 | ], |
| 789 | 'separator' => 'before' |
| 790 | ] |
| 791 | ); |
| 792 | |
| 793 | $this->add_responsive_control( |
| 794 | 'shopengine_product_review_submit_button_padding', |
| 795 | [ |
| 796 | 'label' => esc_html__('Padding (px)', 'shopengine'), |
| 797 | 'type' => Controls_Manager::DIMENSIONS, |
| 798 | 'size_units' => ['px'], |
| 799 | 'default' => [ |
| 800 | 'top' => '10', |
| 801 | 'right' => '25', |
| 802 | 'bottom' => '10', |
| 803 | 'left' => '25', |
| 804 | 'unit' => 'px', |
| 805 | 'isLinked' => false, |
| 806 | ], |
| 807 | 'selectors' => [ |
| 808 | '{{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 809 | '.rtl {{WRAPPER}} div.shopengine-product-review #review_form #respond .comment-form .form-submit input#submit' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 810 | ], |
| 811 | 'separator' => 'before' |
| 812 | ] |
| 813 | ); |
| 814 | |
| 815 | $this->end_controls_section(); // end ./ submit button |
| 816 | |
| 817 | $this->start_controls_section( |
| 818 | 'shopengine_product_review_global_font', |
| 819 | [ |
| 820 | 'label' => esc_html__('Global Font', 'shopengine'), |
| 821 | 'tab' => Controls_Manager::TAB_STYLE, |
| 822 | ] |
| 823 | ); |
| 824 | |
| 825 | $this->add_control( |
| 826 | 'shopengine_product_review_font_family', |
| 827 | [ |
| 828 | 'label' => esc_html__('Font Family', 'shopengine'), |
| 829 | 'description' => esc_html__('This font family is set for this specific widget.', 'shopengine'), |
| 830 | 'type' => Controls_Manager::FONT, |
| 831 | 'default' => '', |
| 832 | 'selectors' => [ |
| 833 | '{{WRAPPER}} .shopengine-product-review' => 'font-family: {{VALUE}} !important;', |
| 834 | '{{WRAPPER}} .shopengine-product-review #reviews :is(a, h2, p, input, .meta span, em, time, .submit, .woocommerce-Reviews-title, .comment-reply-title)' => 'font-family: {{VALUE}} !important;', |
| 835 | ], |
| 836 | ] |
| 837 | ); |
| 838 | |
| 839 | $this->end_controls_section(); |
| 840 | } |
| 841 | |
| 842 | protected function screen() { |
| 843 | |
| 844 | $settings = $this->get_settings_for_display(); |
| 845 | |
| 846 | $post_type = get_post_type(); |
| 847 | |
| 848 | $product = Products::instance()->get_product($post_type); |
| 849 | |
| 850 | |
| 851 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 852 | |
| 853 | $this->avatar_size = isset($settings['shopengine_product_review_author_avatar_width']['size']) ? $settings['shopengine_product_review_author_avatar_width']['size'] : 60; |
| 854 | |
| 855 | add_filter( 'pre_get_avatar_data', [$this, 'change_avatar_size'], 99, 2); |
| 856 | |
| 857 | include $tpl; |
| 858 | } |
| 859 | |
| 860 | private $avatar_size; |
| 861 | |
| 862 | public function change_avatar_size($args, $id_or_email) { |
| 863 | |
| 864 | $args['size'] = $this->avatar_size; |
| 865 | |
| 866 | return $args; |
| 867 | } |
| 868 | } |
| 869 |