dep
5 years ago
premium-banner.php
5 years ago
premium-blog.php
5 years ago
premium-button.php
5 years ago
premium-carousel.php
5 years ago
premium-contactform.php
5 years ago
premium-countdown.php
5 years ago
premium-counter.php
5 years ago
premium-dual-header.php
5 years ago
premium-fancytext.php
5 years ago
premium-grid.php
5 years ago
premium-icon-list.php
5 years ago
premium-image-button.php
5 years ago
premium-image-scroll.php
5 years ago
premium-image-separator.php
5 years ago
premium-lottie.php
5 years ago
premium-maps.php
5 years ago
premium-modalbox.php
5 years ago
premium-person.php
5 years ago
premium-pricing-table.php
5 years ago
premium-progressbar.php
5 years ago
premium-testimonials.php
5 years ago
premium-title.php
5 years ago
premium-videobox.php
5 years ago
premium-vscroll.php
5 years ago
premium-testimonials.php
809 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Premium Testimonials. |
| 5 | */ |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 10 | use Elementor\Widget_Base; |
| 11 | use Elementor\Utils; |
| 12 | use Elementor\Control_Media; |
| 13 | use Elementor\Controls_Manager; |
| 14 | use Elementor\Scheme_Color; |
| 15 | use Elementor\Scheme_Typography; |
| 16 | use Elementor\Group_Control_Typography; |
| 17 | use Elementor\Group_Control_Border; |
| 18 | use Elementor\Group_Control_Text_Shadow; |
| 19 | use Elementor\Group_Control_Box_Shadow; |
| 20 | use Elementor\Group_Control_Background; |
| 21 | |
| 22 | // PremiumAddons Classes. |
| 23 | use PremiumAddons\Includes\Helper_Functions; |
| 24 | |
| 25 | if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort. |
| 26 | |
| 27 | /** |
| 28 | * Class Premium_Testimonials |
| 29 | */ |
| 30 | class Premium_Testimonials extends Widget_Base { |
| 31 | |
| 32 | public function get_name() { |
| 33 | return 'premium-addon-testimonials'; |
| 34 | } |
| 35 | |
| 36 | public function get_title() { |
| 37 | return sprintf( '%1$s %2$s', Helper_Functions::get_prefix(), __('Testimonial', 'premium-addons-for-elementor') ); |
| 38 | } |
| 39 | |
| 40 | public function get_icon() { |
| 41 | return 'pa-testimonials'; |
| 42 | } |
| 43 | |
| 44 | public function get_style_depends() { |
| 45 | return [ |
| 46 | 'font-awesome-5-all', |
| 47 | 'premium-addons' |
| 48 | ]; |
| 49 | } |
| 50 | |
| 51 | public function get_categories() { |
| 52 | return [ 'premium-elements' ]; |
| 53 | } |
| 54 | |
| 55 | public function get_custom_help_url() { |
| 56 | return 'https://premiumaddons.com/support/'; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Register Testimonials controls. |
| 61 | * |
| 62 | * @since 1.0.0 |
| 63 | * @access protected |
| 64 | */ |
| 65 | protected function _register_controls() { |
| 66 | |
| 67 | $this->start_controls_section('premium_testimonial_person_settings', |
| 68 | [ |
| 69 | 'label' => __('Author', 'premium-addons-for-elementor'), |
| 70 | ] |
| 71 | ); |
| 72 | |
| 73 | $this->add_control('premium_testimonial_person_image', |
| 74 | [ |
| 75 | 'label' => __('Image','premium-addons-for-elementor'), |
| 76 | 'type' => Controls_Manager::MEDIA, |
| 77 | 'dynamic' => [ 'active' => true ], |
| 78 | 'default' => [ |
| 79 | 'url' => Utils::get_placeholder_image_src() |
| 80 | ], |
| 81 | 'description' => __( 'Choose an image for the author', 'premium-addons-for-elementor' ), |
| 82 | 'show_label' => true, |
| 83 | ] |
| 84 | ); |
| 85 | |
| 86 | $this->add_control('premium_testimonial_person_image_shape', |
| 87 | [ |
| 88 | 'label' => __('Image Style', 'premium-addons-for-elementor'), |
| 89 | 'type' => Controls_Manager::SELECT, |
| 90 | 'description' => __( 'Choose image style', 'premium-addons-for-elementor' ), |
| 91 | 'options' => [ |
| 92 | 'square' => __('Square','premium-addons-for-elementor'), |
| 93 | 'circle' => __('Circle','premium-addons-for-elementor'), |
| 94 | 'rounded' => __('Rounded','premium-addons-for-elementor'), |
| 95 | ], |
| 96 | 'default' => 'circle', |
| 97 | ] |
| 98 | ); |
| 99 | |
| 100 | $this->add_control('premium_testimonial_person_name', |
| 101 | [ |
| 102 | 'label' => __('Name', 'premium-addons-for-elementor'), |
| 103 | 'type' => Controls_Manager::TEXT, |
| 104 | 'default' => 'John Doe', |
| 105 | 'dynamic' => [ 'active' => true ], |
| 106 | 'label_block' => true |
| 107 | ] |
| 108 | ); |
| 109 | |
| 110 | $this->add_control('premium_testimonial_person_name_size', |
| 111 | [ |
| 112 | 'label' => __('HTML Tag', 'premium-addons-for-elementor'), |
| 113 | 'type' => Controls_Manager::SELECT, |
| 114 | 'description' => __( 'Select a heading tag for author name', 'premium-addons-for-elementor' ), |
| 115 | 'options' => [ |
| 116 | 'h1' => 'H1', |
| 117 | 'h2' => 'H2', |
| 118 | 'h3' => 'H3', |
| 119 | 'h4' => 'H4', |
| 120 | 'h5' => 'H5', |
| 121 | 'h6' => 'H6', |
| 122 | 'div' => 'div', |
| 123 | 'span' => 'span', |
| 124 | 'p' => 'p', |
| 125 | ], |
| 126 | 'default' => 'h3', |
| 127 | 'label_block' => true, |
| 128 | ] |
| 129 | ); |
| 130 | |
| 131 | $this->add_control('separator_text', |
| 132 | [ |
| 133 | 'label' => __('Separator', 'premium-addons-for-elementor'), |
| 134 | 'type' => Controls_Manager::TEXT, |
| 135 | 'dynamic' => [ 'active' => true ], |
| 136 | 'default' => '-', |
| 137 | 'separator' => 'befpre' |
| 138 | ] |
| 139 | ); |
| 140 | |
| 141 | $this->add_control('separator_align', |
| 142 | [ |
| 143 | 'label' => __('Align', 'premium-addons-for-elementor'), |
| 144 | 'type' => Controls_Manager::SELECT, |
| 145 | 'options' => [ |
| 146 | 'row' => __('Inline','premium-addons-for-elementor'), |
| 147 | 'column' => __('Block','premium-addons-for-elementor'), |
| 148 | ], |
| 149 | 'default' => 'row', |
| 150 | 'prefix_class' => 'premium-testimonial-separator-', |
| 151 | 'selectors' => [ |
| 152 | '{{WRAPPER}} .premium-testimonial-author-info'=> 'flex-direction: {{VALUE}}', |
| 153 | ] |
| 154 | ] |
| 155 | ); |
| 156 | |
| 157 | $this->add_control('separator_spacing', |
| 158 | [ |
| 159 | 'label' => __('Spacing', 'premium-addons-for-elementor'), |
| 160 | 'type' => Controls_Manager::SLIDER, |
| 161 | 'size_units' => ['px', 'em'], |
| 162 | 'default' => [ |
| 163 | 'unit' => 'px', |
| 164 | 'size' => 5, |
| 165 | ], |
| 166 | 'selectors' => [ |
| 167 | '{{WRAPPER}}.premium-testimonial-separator-row .premium-testimonial-separator' => 'margin-right: calc( {{SIZE}}{{UNIT}}/2 ); margin-left: calc( {{SIZE}}{{UNIT}}/2 );', |
| 168 | '{{WRAPPER}}.premium-testimonial-separator-column .premium-testimonial-separator' => 'margin-top: calc( {{SIZE}}{{UNIT}}/2 ); margin-bottom: calc( {{SIZE}}{{UNIT}}/2 );', |
| 169 | ] |
| 170 | ] |
| 171 | ); |
| 172 | |
| 173 | $this->end_controls_section(); |
| 174 | |
| 175 | $this->start_controls_section('premium_testimonial_company_settings', |
| 176 | [ |
| 177 | 'label' => __('Company', 'premium-addons-for-elementor') |
| 178 | ] |
| 179 | ); |
| 180 | |
| 181 | $this->add_control('premium_testimonial_company_name', |
| 182 | [ |
| 183 | 'label' => __('Name', 'premium-addons-for-elementor'), |
| 184 | 'type' => Controls_Manager::TEXT, |
| 185 | 'dynamic' => [ 'active' => true ], |
| 186 | 'default' => 'Leap13', |
| 187 | 'label_block' => true, |
| 188 | ] |
| 189 | ); |
| 190 | |
| 191 | $this->add_control('premium_testimonial_company_name_size', |
| 192 | [ |
| 193 | 'label' => __('HTML Tag', 'premium-addons-for-elementor'), |
| 194 | 'type' => Controls_Manager::SELECT, |
| 195 | 'description' => __( 'Select a heading tag for company name', 'premium-addons-for-elementor' ), |
| 196 | 'options' => [ |
| 197 | 'h1' => 'H1', |
| 198 | 'h2' => 'H2', |
| 199 | 'h3' => 'H3', |
| 200 | 'h4' => 'H4', |
| 201 | 'h5' => 'H5', |
| 202 | 'h6' => 'H6', |
| 203 | 'div' => 'div', |
| 204 | 'span' => 'span', |
| 205 | 'p' => 'p', |
| 206 | ], |
| 207 | 'default' => 'h4', |
| 208 | 'label_block' => true, |
| 209 | ] |
| 210 | ); |
| 211 | |
| 212 | $this->add_control('premium_testimonial_company_link_switcher', |
| 213 | [ |
| 214 | 'label' => __('Link', 'premium-addons-for-elementor'), |
| 215 | 'type' => Controls_Manager::SWITCHER, |
| 216 | 'default' => 'yes', |
| 217 | ] |
| 218 | ); |
| 219 | |
| 220 | $this->add_control('premium_testimonial_company_link', |
| 221 | [ |
| 222 | 'label' => __('Link', 'premium-addons-for-elementor'), |
| 223 | 'type' => Controls_Manager::TEXT, |
| 224 | 'dynamic' => [ |
| 225 | 'active' => true, |
| 226 | 'categories' => [ |
| 227 | TagsModule::POST_META_CATEGORY, |
| 228 | TagsModule::URL_CATEGORY |
| 229 | ] |
| 230 | ], |
| 231 | 'description' => __( 'Add company URL', 'premium-addons-for-elementor' ), |
| 232 | 'label_block' => true, |
| 233 | 'condition' => [ |
| 234 | 'premium_testimonial_company_link_switcher' => 'yes' |
| 235 | ] |
| 236 | ] |
| 237 | ); |
| 238 | |
| 239 | $this->add_control('premium_testimonial_link_target', |
| 240 | [ |
| 241 | 'label' => __('Link Target', 'premium-addons-for-elementor'), |
| 242 | 'type' => Controls_Manager::SELECT, |
| 243 | 'description' => __( 'Select link target', 'premium-addons-for-elementor' ), |
| 244 | 'options' => [ |
| 245 | 'blank' => __('Blank'), |
| 246 | 'parent' => __('Parent'), |
| 247 | 'self' => __('Self'), |
| 248 | 'top' => __('Top'), |
| 249 | ], |
| 250 | 'default' => __('blank','premium-addons-for-elementor'), |
| 251 | 'condition' => [ |
| 252 | 'premium_testimonial_company_link_switcher' => 'yes' |
| 253 | ] |
| 254 | ] |
| 255 | ); |
| 256 | |
| 257 | $this->end_controls_section(); |
| 258 | |
| 259 | $this->start_controls_section('premium_testimonial_settings', |
| 260 | [ |
| 261 | 'label' => __('Content', 'premium-addons-for-elementor'), |
| 262 | ] |
| 263 | ); |
| 264 | |
| 265 | $this->add_control('premium_testimonial_content', |
| 266 | [ |
| 267 | 'label' => __('Testimonial Content', 'premium-addons-for-elementor'), |
| 268 | 'type' => Controls_Manager::WYSIWYG, |
| 269 | 'dynamic' => [ 'active' => true ], |
| 270 | 'default' => __('Donec id elit non mi porta gravida at eget metus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Cras mattis consectetur purus sit amet fermentum. Nullam id dolor id nibh ultricies vehicula ut id elit. Donec id elit non mi porta gravida at eget metus.','premium-addons-for-elementor'), |
| 271 | 'label_block' => true, |
| 272 | ] |
| 273 | ); |
| 274 | |
| 275 | $this->end_controls_section(); |
| 276 | |
| 277 | $this->start_controls_section('section_pa_docs', |
| 278 | [ |
| 279 | 'label' => __('Helpful Documentations', 'premium-addons-for-elementor'), |
| 280 | ] |
| 281 | ); |
| 282 | |
| 283 | $doc1_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/why-im-not-able-to-see-elementor-font-awesome-5-icons-in-premium-add-ons', 'editor-page', 'wp-editor', 'get-support' ); |
| 284 | |
| 285 | $this->add_control('doc_1', |
| 286 | [ |
| 287 | 'type' => Controls_Manager::RAW_HTML, |
| 288 | 'raw' => sprintf( __( '%1$s I\'m not able to see Font Awesome icons in the widget » %2$s', 'premium-addons-for-elementor' ), '<a href="https://premiumaddons.com/docs/why-im-not-able-to-see-elementor-font-awesome-5-icons-in-premium-add-ons/?utm_source=papro-dashboard&utm_medium=papro-editor&utm_campaign=papro-plugin" target="_blank" rel="noopener">', '</a>' ), |
| 289 | 'content_classes' => 'editor-pa-doc', |
| 290 | ] |
| 291 | ); |
| 292 | |
| 293 | $this->end_controls_section(); |
| 294 | |
| 295 | $this->start_controls_section('premium_testimonial_image_style', |
| 296 | [ |
| 297 | 'label' => __('Image', 'premium-addons-for-elementor'), |
| 298 | 'tab' => Controls_Manager::TAB_STYLE, |
| 299 | ] |
| 300 | ); |
| 301 | |
| 302 | $this->add_control('premium_testimonial_img_size', |
| 303 | [ |
| 304 | 'label' => __('Size', 'premium-addons-for-elementor'), |
| 305 | 'type' => Controls_Manager::SLIDER, |
| 306 | 'size_units' => ['px', 'em'], |
| 307 | 'default' => [ |
| 308 | 'unit' => 'px', |
| 309 | 'size' => 110, |
| 310 | ], |
| 311 | 'range' => [ |
| 312 | 'px'=> [ |
| 313 | 'min' => 10, |
| 314 | 'max' => 150, |
| 315 | ] |
| 316 | ], |
| 317 | 'selectors' => [ |
| 318 | '{{WRAPPER}} .premium-testimonial-img-wrapper'=> 'width: {{SIZE}}{{UNIT}}; height:{{SIZE}}{{UNIT}}', |
| 319 | ] |
| 320 | ] |
| 321 | ); |
| 322 | |
| 323 | $this->add_control('premium_testimonial_img_border_width', |
| 324 | [ |
| 325 | 'label' => __('Border Width (PX)', 'premium-addons-for-elementor'), |
| 326 | 'type' => Controls_Manager::SLIDER, |
| 327 | 'default' => [ |
| 328 | 'unit' => 'px', |
| 329 | 'size' => 2, |
| 330 | ], |
| 331 | 'range' => [ |
| 332 | 'px'=> [ |
| 333 | 'min' => 0, |
| 334 | 'max' => 15, |
| 335 | ] |
| 336 | ], |
| 337 | 'selectors' => [ |
| 338 | '{{WRAPPER}} .premium-testimonial-img-wrapper' => 'border-width: {{SIZE}}{{UNIT}}', |
| 339 | ] |
| 340 | ] |
| 341 | ); |
| 342 | |
| 343 | $this->add_control('premium_testimonial_image_border_color', |
| 344 | [ |
| 345 | 'label' => __('Border Color', 'premium-addons-for-elementor'), |
| 346 | 'type' => Controls_Manager::COLOR, |
| 347 | 'scheme' => [ |
| 348 | 'type' => Scheme_Color::get_type(), |
| 349 | 'value' => Scheme_Color::COLOR_1, |
| 350 | ], |
| 351 | 'selectors' => [ |
| 352 | '{{WRAPPER}} .premium-testimonial-img-wrapper' => 'border-color: {{VALUE}};', |
| 353 | ] |
| 354 | ] |
| 355 | ); |
| 356 | |
| 357 | $this->end_controls_section(); |
| 358 | |
| 359 | $this->start_controls_section('premium_testimonials_person_style', |
| 360 | [ |
| 361 | 'label' => __('Author', 'premium-addons-for-elementor'), |
| 362 | 'tab' => Controls_Manager::TAB_STYLE, |
| 363 | ] |
| 364 | ); |
| 365 | |
| 366 | $this->add_control('premium_testimonial_person_name_color', |
| 367 | [ |
| 368 | 'label' => __('Author Color', 'premium-addons-for-elementor'), |
| 369 | 'type' => Controls_Manager::COLOR, |
| 370 | 'scheme' => [ |
| 371 | 'type' => Scheme_Color::get_type(), |
| 372 | 'value' => Scheme_Color::COLOR_1, |
| 373 | ], |
| 374 | 'selectors' => [ |
| 375 | '{{WRAPPER}} .premium-testimonial-person-name' => 'color: {{VALUE}};', |
| 376 | ] |
| 377 | ] |
| 378 | ); |
| 379 | |
| 380 | $this->add_group_control( |
| 381 | Group_Control_Typography::get_type(), |
| 382 | [ |
| 383 | 'name' => 'author_name_typography', |
| 384 | 'label' => __('Name Typograhy', 'premium-addons-for-elementor'), |
| 385 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 386 | 'selector' => '{{WRAPPER}} .premium-testimonial-person-name', |
| 387 | ] |
| 388 | ); |
| 389 | |
| 390 | $this->add_group_control( |
| 391 | Group_Control_Text_Shadow::get_type(), |
| 392 | [ |
| 393 | 'name' => 'author_name_shadow', |
| 394 | 'selector' => '{{WRAPPER}} .premium-testimonial-person-name' |
| 395 | ] |
| 396 | ); |
| 397 | |
| 398 | $this->add_control('premium_testimonial_separator_color', |
| 399 | [ |
| 400 | 'label' => __('Separator Color', 'premium-addons-for-elementor'), |
| 401 | 'type' => Controls_Manager::COLOR, |
| 402 | 'scheme' => [ |
| 403 | 'type' => Scheme_Color::get_type(), |
| 404 | 'value' => Scheme_Color::COLOR_1, |
| 405 | ], |
| 406 | 'separator' => 'before', |
| 407 | 'condition' => [ |
| 408 | 'separator_text!' => '' |
| 409 | ], |
| 410 | 'selectors' => [ |
| 411 | '{{WRAPPER}} .premium-testimonial-separator' => 'color: {{VALUE}};', |
| 412 | ], |
| 413 | ] |
| 414 | ); |
| 415 | |
| 416 | $this->add_group_control( |
| 417 | Group_Control_Typography::get_type(), |
| 418 | [ |
| 419 | 'name' => 'separator_typography', |
| 420 | 'label' => __('Separator Typograhy', 'premium-addons-for-elementor'), |
| 421 | 'condition' => [ |
| 422 | 'separator_text!' => '' |
| 423 | ], |
| 424 | 'selector' => '{{WRAPPER}} .premium-testimonial-separator', |
| 425 | ] |
| 426 | ); |
| 427 | |
| 428 | $this->end_controls_section(); |
| 429 | |
| 430 | $this->start_controls_section('premium_testimonial_company_style', |
| 431 | [ |
| 432 | 'label' => __('Company', 'premium-addons-for-elementor'), |
| 433 | 'tab' => Controls_Manager::TAB_STYLE, |
| 434 | ] |
| 435 | ); |
| 436 | |
| 437 | $this->add_control('premium_testimonial_company_name_color', |
| 438 | [ |
| 439 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 440 | 'type' => Controls_Manager::COLOR, |
| 441 | 'scheme' => [ |
| 442 | 'type' => Scheme_Color::get_type(), |
| 443 | 'value' => Scheme_Color::COLOR_2, |
| 444 | ], |
| 445 | 'selectors' => [ |
| 446 | '{{WRAPPER}} .premium-testimonial-company-link' => 'color: {{VALUE}};', |
| 447 | ] |
| 448 | ] |
| 449 | ); |
| 450 | |
| 451 | $this->add_group_control( |
| 452 | Group_Control_Typography::get_type(), |
| 453 | [ |
| 454 | 'name' => 'company_name_typography', |
| 455 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 456 | 'selector' => '{{WRAPPER}} .premium-testimonial-company-link', |
| 457 | ] |
| 458 | ); |
| 459 | |
| 460 | $this->add_group_control( |
| 461 | Group_Control_Text_Shadow::get_type(), |
| 462 | [ |
| 463 | 'name' => 'company_name_shadow', |
| 464 | 'selector' => '{{WRAPPER}} .premium-testimonial-company-link' |
| 465 | ] |
| 466 | ); |
| 467 | |
| 468 | $this->end_controls_section(); |
| 469 | |
| 470 | $this->start_controls_section('premium_testimonial_content_style', |
| 471 | [ |
| 472 | 'label' => __('Content', 'premium-addons-for-elementor'), |
| 473 | 'tab' => Controls_Manager::TAB_STYLE, |
| 474 | ] |
| 475 | ); |
| 476 | |
| 477 | $this->add_control('premium_testimonial_content_color', |
| 478 | [ |
| 479 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 480 | 'type' => Controls_Manager::COLOR, |
| 481 | 'scheme' => [ |
| 482 | 'type' => Scheme_Color::get_type(), |
| 483 | 'value' => Scheme_Color::COLOR_3, |
| 484 | ], |
| 485 | 'selectors' => [ |
| 486 | '{{WRAPPER}} .premium-testimonial-text-wrapper' => 'color: {{VALUE}};', |
| 487 | ] |
| 488 | ] |
| 489 | ); |
| 490 | |
| 491 | $this->add_group_control( |
| 492 | Group_Control_Typography::get_type(), |
| 493 | [ |
| 494 | 'name' => 'content_typography', |
| 495 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 496 | 'selector' => '{{WRAPPER}} .premium-testimonial-text-wrapper', |
| 497 | ] |
| 498 | ); |
| 499 | |
| 500 | $this->add_responsive_control('premium_testimonial_margin', |
| 501 | [ |
| 502 | 'label' => __('Margin', 'premium-addons-for-elementor'), |
| 503 | 'type' => Controls_Manager::DIMENSIONS, |
| 504 | 'size_units' => ['px', 'em', '%'], |
| 505 | 'default' =>[ |
| 506 | 'top' => 15, |
| 507 | 'bottom'=> 15, |
| 508 | 'left' => 0 , |
| 509 | 'right' => 0 , |
| 510 | 'unit' => 'px', |
| 511 | ], |
| 512 | 'selectors' => [ |
| 513 | '{{WRAPPER}} .premium-testimonial-text-wrapper' => 'margin: {{top}}{{UNIT}} {{right}}{{UNIT}} {{bottom}}{{UNIT}} {{left}}{{UNIT}};', |
| 514 | ] |
| 515 | ] |
| 516 | ); |
| 517 | |
| 518 | $this->end_controls_section(); |
| 519 | |
| 520 | $this->start_controls_section('premium_testimonial_quotes', |
| 521 | [ |
| 522 | 'label' => __('Quotation Icon', 'premium-addons-for-elementor'), |
| 523 | 'tab' => Controls_Manager::TAB_STYLE, |
| 524 | ] |
| 525 | ); |
| 526 | |
| 527 | $this->add_control('premium_testimonial_quote_icon_color', |
| 528 | [ |
| 529 | 'label' => __('Color','premium-addons-for-elementor'), |
| 530 | 'type' => Controls_Manager::COLOR, |
| 531 | 'default' => 'rgba(110,193,228,0.2)', |
| 532 | 'selectors' => [ |
| 533 | '{{WRAPPER}} .premium-testimonial-upper-quote, {{WRAPPER}} .premium-testimonial-lower-quote' => 'color: {{VALUE}};', |
| 534 | ] |
| 535 | ] |
| 536 | ); |
| 537 | |
| 538 | $this->add_control('premium_testimonial_quotes_size', |
| 539 | [ |
| 540 | 'label' => __('Size', 'premium-addons-for-elementor'), |
| 541 | 'type' => Controls_Manager::SLIDER, |
| 542 | 'size_units' => ['px', 'em', '%'], |
| 543 | 'default' => [ |
| 544 | 'unit' => 'px', |
| 545 | 'size' => 120, |
| 546 | ], |
| 547 | 'range' => [ |
| 548 | 'px' => [ |
| 549 | 'min' => 5, |
| 550 | 'max' => 250, |
| 551 | ] |
| 552 | ], |
| 553 | 'selectors' => [ |
| 554 | '{{WRAPPER}} .premium-testimonial-upper-quote, {{WRAPPER}} .premium-testimonial-lower-quote' => 'font-size: {{SIZE}}{{UNIT}};', |
| 555 | ] |
| 556 | ] |
| 557 | ); |
| 558 | |
| 559 | $this->add_responsive_control('premium_testimonial_upper_quote_position', |
| 560 | [ |
| 561 | 'label' => __('Top Icon Position', 'premium-addons-for-elementor'), |
| 562 | 'type' => Controls_Manager::DIMENSIONS, |
| 563 | 'size_units' => ['px', 'em', '%'], |
| 564 | 'default' =>[ |
| 565 | 'top' => 70, |
| 566 | 'left' => 12 , |
| 567 | 'unit' => 'px', |
| 568 | ], |
| 569 | 'selectors' => [ |
| 570 | '{{WRAPPER}} .premium-testimonial-upper-quote' => 'top: {{TOP}}{{UNIT}}; left:{{LEFT}}{{UNIT}};', |
| 571 | ] |
| 572 | ] |
| 573 | ); |
| 574 | |
| 575 | $this->add_responsive_control('premium_testimonial_lower_quote_position', |
| 576 | [ |
| 577 | 'label' => __('Bottom Icon Position', 'premium-addons-for-elementor'), |
| 578 | 'type' => Controls_Manager::DIMENSIONS, |
| 579 | 'size_units' => ['px', 'em', '%'], |
| 580 | 'default' =>[ |
| 581 | 'bottom' => 3, |
| 582 | 'right' => 12, |
| 583 | 'unit' => 'px', |
| 584 | ], |
| 585 | 'selectors' => [ |
| 586 | '{{WRAPPER}} .premium-testimonial-lower-quote' => 'right: {{RIGHT}}{{UNIT}}; bottom: {{BOTTOM}}{{UNIT}};', |
| 587 | ] |
| 588 | ] |
| 589 | ); |
| 590 | |
| 591 | $this->end_controls_section(); |
| 592 | |
| 593 | $this->start_controls_section('premium_testimonial_container_style', |
| 594 | [ |
| 595 | 'label' => __('Container','premium-addons-for-elementor'), |
| 596 | 'tab' => Controls_Manager::TAB_STYLE, |
| 597 | ] |
| 598 | ); |
| 599 | |
| 600 | $this->add_group_control( |
| 601 | Group_Control_Background::get_type(), |
| 602 | [ |
| 603 | 'name' => 'premium_testimonial_background', |
| 604 | 'types' => [ 'classic' , 'gradient' ], |
| 605 | 'selector' => '{{WRAPPER}} .premium-testimonial-content-wrapper' |
| 606 | ] |
| 607 | ); |
| 608 | |
| 609 | $this->add_group_control( |
| 610 | Group_Control_Border::get_type(), |
| 611 | [ |
| 612 | 'name' => 'premium_testimonial_container_border', |
| 613 | 'selector' => '{{WRAPPER}} .premium-testimonial-content-wrapper', |
| 614 | ] |
| 615 | ); |
| 616 | |
| 617 | $this->add_control('premium_testimonial_container_border_radius', |
| 618 | [ |
| 619 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 620 | 'type' => Controls_Manager::SLIDER, |
| 621 | 'size_units' => ['px', 'em', '%'], |
| 622 | 'selectors' => [ |
| 623 | '{{WRAPPER}} .premium-testimonial-content-wrapper' => 'border-radius: {{SIZE}}{{UNIT}}' |
| 624 | ] |
| 625 | ] |
| 626 | ); |
| 627 | |
| 628 | $this->add_group_control( |
| 629 | Group_Control_Box_Shadow::get_type(), |
| 630 | [ |
| 631 | 'name' => 'premium_testimonial_container_box_shadow', |
| 632 | 'selector' => '{{WRAPPER}} .premium-testimonial-content-wrapper', |
| 633 | ] |
| 634 | ); |
| 635 | |
| 636 | $this->add_responsive_control('premium_testimonial_box_padding', |
| 637 | [ |
| 638 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 639 | 'type' => Controls_Manager::DIMENSIONS, |
| 640 | 'size_units' => [ 'px', 'em', '%' ], |
| 641 | 'selectors' => [ |
| 642 | '{{WRAPPER}} .premium-testimonial-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 643 | ] |
| 644 | ] |
| 645 | ); |
| 646 | |
| 647 | $this->end_controls_section(); |
| 648 | |
| 649 | } |
| 650 | |
| 651 | /** |
| 652 | * Render Testimonials widget output on the frontend. |
| 653 | * |
| 654 | * Written in PHP and used to generate the final HTML. |
| 655 | * |
| 656 | * @since 1.0.0 |
| 657 | * @access protected |
| 658 | */ |
| 659 | protected function render() { |
| 660 | |
| 661 | $settings = $this->get_settings_for_display(); |
| 662 | |
| 663 | $this->add_inline_editing_attributes('premium_testimonial_person_name'); |
| 664 | $this->add_inline_editing_attributes('premium_testimonial_company_name'); |
| 665 | $this->add_inline_editing_attributes('premium_testimonial_content', 'advanced'); |
| 666 | $person_title_tag = $settings['premium_testimonial_person_name_size']; |
| 667 | |
| 668 | $company_title_tag = $settings['premium_testimonial_company_name_size']; |
| 669 | |
| 670 | $image_src = ''; |
| 671 | |
| 672 | if( ! empty( $settings['premium_testimonial_person_image']['url'] ) ) { |
| 673 | $image_src = $settings['premium_testimonial_person_image']['url']; |
| 674 | $alt = esc_attr( Control_Media::get_image_alt( $settings['premium_testimonial_person_image'] ) ); |
| 675 | } |
| 676 | |
| 677 | $this->add_render_attribute('testimonial', 'class', [ |
| 678 | 'premium-testimonial-box' |
| 679 | ]); |
| 680 | |
| 681 | $this->add_render_attribute('img_wrap', 'class', [ |
| 682 | 'premium-testimonial-img-wrapper', |
| 683 | $settings['premium_testimonial_person_image_shape'] |
| 684 | ]); |
| 685 | |
| 686 | ?> |
| 687 | |
| 688 | <div <?php echo $this->get_render_attribute_string('testimonial'); ?>> |
| 689 | <div class="premium-testimonial-container"> |
| 690 | <i class="fa fa-quote-left premium-testimonial-upper-quote"></i> |
| 691 | <div class="premium-testimonial-content-wrapper"> |
| 692 | <?php if ( ! empty( $image_src ) ) : ?> |
| 693 | <div <?php echo $this->get_render_attribute_string('img_wrap'); ?>> |
| 694 | <img src="<?php echo $image_src; ?>" alt="<?php echo $alt; ?>" class="premium-testimonial-person-image"> |
| 695 | </div> |
| 696 | <?php endif; ?> |
| 697 | |
| 698 | <div class="premium-testimonial-text-wrapper"> |
| 699 | <div <?php echo $this->get_render_attribute_string('premium_testimonial_content'); ?>> |
| 700 | <?php echo $settings['premium_testimonial_content']; ?> |
| 701 | </div> |
| 702 | </div> |
| 703 | |
| 704 | <div class="premium-testimonial-author-info"> |
| 705 | <<?php echo $person_title_tag; ?> class="premium-testimonial-person-name"> |
| 706 | <span <?php echo $this->get_render_attribute_string('premium_testimonial_person_name'); ?>><?php echo $settings['premium_testimonial_person_name']; ?></span> |
| 707 | </<?php echo $person_title_tag; ?>> |
| 708 | |
| 709 | <span class="premium-testimonial-separator"><?php echo esc_html( $settings['separator_text'] ); ?></span> |
| 710 | |
| 711 | <<?php echo $company_title_tag; ?> class="premium-testimonial-company-name"> |
| 712 | <?php if( $settings['premium_testimonial_company_link_switcher'] === 'yes') : ?> |
| 713 | <a class="premium-testimonial-company-link" href="<?php echo $settings['premium_testimonial_company_link']; ?>" target="_<?php echo $settings['premium_testimonial_link_target']; ?>"> |
| 714 | <span <?php echo $this->get_render_attribute_string('premium_testimonial_company_name'); ?>><?php echo $settings['premium_testimonial_company_name']; ?></span> |
| 715 | </a> |
| 716 | <?php else: ?> |
| 717 | <span class="premium-testimonial-company-link" <?php echo $this->get_render_attribute_string('premium_testimonial_company_name'); ?>> |
| 718 | <?php echo $settings['premium_testimonial_company_name']; ?> |
| 719 | </span> |
| 720 | <?php endif; ?> |
| 721 | </<?php echo $company_title_tag; ?>> |
| 722 | </div> |
| 723 | </div> |
| 724 | <i class="fa fa-quote-right premium-testimonial-lower-quote"></i> |
| 725 | </div> |
| 726 | </div> |
| 727 | <?php |
| 728 | |
| 729 | } |
| 730 | |
| 731 | /** |
| 732 | * Render Testimonials widget output in the editor. |
| 733 | * |
| 734 | * Written as a Backbone JavaScript template and used to generate the live preview. |
| 735 | * |
| 736 | * @since 1.0.0 |
| 737 | * @access protected |
| 738 | */ |
| 739 | protected function content_template() { |
| 740 | ?> |
| 741 | <# |
| 742 | |
| 743 | view.addInlineEditingAttributes('premium_testimonial_person_name'); |
| 744 | view.addInlineEditingAttributes('premium_testimonial_company_name'); |
| 745 | view.addInlineEditingAttributes('premium_testimonial_content', 'advanced'); |
| 746 | view.addRenderAttribute('premium_testimonial_company_name', 'class', 'premium-testimonial-company-link'); |
| 747 | |
| 748 | var personTag = settings.premium_testimonial_person_name_size, |
| 749 | companyTag = settings.premium_testimonial_company_name_size, |
| 750 | imageSrc = '', |
| 751 | imageSrc, |
| 752 | borderRadius; |
| 753 | |
| 754 | if( '' != settings.premium_testimonial_person_image.url ) { |
| 755 | imageSrc = settings.premium_testimonial_person_image.url; |
| 756 | } |
| 757 | |
| 758 | view.addRenderAttribute('testimonial', 'class', [ |
| 759 | 'premium-testimonial-box' |
| 760 | ]); |
| 761 | |
| 762 | view.addRenderAttribute('img_wrap', 'class', [ |
| 763 | 'premium-testimonial-img-wrapper', |
| 764 | settings.premium_testimonial_person_image_shape |
| 765 | ]); |
| 766 | |
| 767 | |
| 768 | #> |
| 769 | |
| 770 | <div {{{ view.getRenderAttributeString('testimonial') }}}> |
| 771 | <div class="premium-testimonial-container"> |
| 772 | <i class="fa fa-quote-left premium-testimonial-upper-quote"></i> |
| 773 | <div class="premium-testimonial-content-wrapper"> |
| 774 | <# if ( '' != imageSrc ) { #> |
| 775 | <div {{{ view.getRenderAttributeString('img_wrap') }}}> |
| 776 | <img src="{{ imageSrc }}" alt="premium-image" class="premium-testimonial-person-image"> |
| 777 | </div> |
| 778 | <# } #> |
| 779 | <div class="premium-testimonial-text-wrapper"> |
| 780 | <div {{{ view.getRenderAttributeString('premium_testimonial_content') }}}>{{{ settings.premium_testimonial_content }}}</div> |
| 781 | </div> |
| 782 | |
| 783 | <div class="premium-testimonial-author-info"> |
| 784 | <{{{personTag}}} class="premium-testimonial-person-name"> |
| 785 | <span {{{ view.getRenderAttributeString('premium_testimonial_person_name') }}}> |
| 786 | {{{ settings.premium_testimonial_person_name }}} |
| 787 | </span> |
| 788 | </{{{personTag}}}> |
| 789 | |
| 790 | <span class="premium-testimonial-separator"> {{{ settings.separator_text }}} </span> |
| 791 | |
| 792 | <{{{companyTag}}} class="premium-testimonial-company-name"> |
| 793 | <a href="{{ settings.premium_testimonial_company_link }}" {{{ view.getRenderAttributeString('premium_testimonial_company_name') }}}> |
| 794 | {{{ settings.premium_testimonial_company_name }}} |
| 795 | </a> |
| 796 | </{{{companyTag}}}> |
| 797 | </div> |
| 798 | |
| 799 | </div> |
| 800 | |
| 801 | <i class="fa fa-quote-right premium-testimonial-lower-quote"></i> |
| 802 | |
| 803 | </div> |
| 804 | </div> |
| 805 | |
| 806 | <?php |
| 807 | } |
| 808 | |
| 809 | } |