| @@ -1,1616 +1,1627 @@ | ||
| 1 | -<?php | |
| 2 | -namespace UiCoreElements\Utils; | |
| 3 | - | |
| 4 | -use Elementor\Controls_Manager; | |
| 5 | -use Elementor\Plugin; | |
| 6 | -use Elementor\Utils; | |
| 7 | -use Elementor\Repeater; | |
| 8 | -use Elementor\Icons_Manager; | |
| 9 | -use Elementor\Group_Control_Image_Size; | |
| 10 | -use Elementor\Group_Control_Box_Shadow; | |
| 11 | -use Elementor\Group_Control_Border; | |
| 12 | -use Elementor\Group_Control_Typography; | |
| 13 | -use Elementor\Group_Control_Text_Shadow; | |
| 14 | -use Elementor\Core\Kits\Documents\Tabs\Global_Colors; | |
| 15 | -use UiCoreElements\Helper; | |
| 16 | - | |
| 17 | - | |
| 18 | -defined('ABSPATH') || exit(); | |
| 19 | - | |
| 20 | -trait Testimonial_Trait { | |
| 21 | - | |
| 22 | - // Content Controls Functions | |
| 23 | - function TRAIT_register_testimonial_repeater_controls($logo) | |
| 24 | - { | |
| 25 | - $this->start_controls_section( | |
| 26 | - 'section_reviewer_content', | |
| 27 | - [ | |
| 28 | - 'label' => __($logo, 'uicore-elements'), | |
| 29 | - 'tab' => Controls_Manager::TAB_CONTENT, | |
| 30 | - ] | |
| 31 | - ); | |
| 32 | - | |
| 33 | - $repeater = new Repeater(); | |
| 34 | - | |
| 35 | - $repeater->add_control( | |
| 36 | - 'avatar', | |
| 37 | - [ | |
| 38 | - 'label' => __('Avatar', 'uicore-elements'), | |
| 39 | - 'type' => Controls_Manager::MEDIA, | |
| 40 | - 'render_type' => 'template', | |
| 41 | - 'dynamic' => [ | |
| 42 | - 'active' => true, | |
| 43 | - ], | |
| 44 | - 'default' => [ | |
| 45 | - 'url' => Utils::get_placeholder_image_src(), | |
| 46 | - ], | |
| 47 | - ] | |
| 48 | - ); | |
| 49 | - $repeater->add_control( | |
| 50 | - 'reviewer_name', | |
| 51 | - [ | |
| 52 | - 'label' => __('Name', 'uicore-elements'), | |
| 53 | - 'type' => Controls_Manager::TEXT, | |
| 54 | - 'dynamic' => [ | |
| 55 | - 'active' => true, | |
| 56 | - ], | |
| 57 | - 'default' => __('Adam Smith', 'uicore-elements'), | |
| 58 | - 'placeholder' => __('Enter reviewer name', 'uicore-elements'), | |
| 59 | - 'label_block' => true, | |
| 60 | - ] | |
| 61 | - ); | |
| 62 | - $repeater->add_control( | |
| 63 | - 'reviewer_job_title', | |
| 64 | - [ | |
| 65 | - 'label' => __('Job Title', 'uicore-elements'), | |
| 66 | - 'type' => Controls_Manager::TEXT, | |
| 67 | - 'dynamic' => [ | |
| 68 | - 'active' => true, | |
| 69 | - ], | |
| 70 | - 'default' => __('SEO Expert', 'uicore-elements'), | |
| 71 | - 'placeholder' => __('Enter reviewer job title', 'uicore-elements'), | |
| 72 | - 'label_block' => true, | |
| 73 | - ] | |
| 74 | - ); | |
| 75 | - $repeater->add_control( | |
| 76 | - 'rating_number', | |
| 77 | - [ | |
| 78 | - 'label' => __( 'Rating', 'uicore-elements' ), | |
| 79 | - 'type' => Controls_Manager::SLIDER, | |
| 80 | - 'size_units' => [ 'px' ], | |
| 81 | - 'default' => [ | |
| 82 | - 'size' => 4.5, | |
| 83 | - ], | |
| 84 | - 'range' => [ | |
| 85 | - 'px' => [ | |
| 86 | - 'min' => 0, | |
| 87 | - 'max' => 5, | |
| 88 | - 'step' => .5, | |
| 89 | - ], | |
| 90 | - ], | |
| 91 | - 'dynamic' => [ | |
| 92 | - 'active' => true, | |
| 93 | - ], | |
| 94 | - ] | |
| 95 | - ); | |
| 96 | - $repeater->add_control( | |
| 97 | - 'review_text', | |
| 98 | - [ | |
| 99 | - 'label' => __('Review Text', 'uicore-elements'), | |
| 100 | - 'type' => Controls_Manager::WYSIWYG, | |
| 101 | - 'dynamic' => [ | |
| 102 | - 'active' => true, | |
| 103 | - ], | |
| 104 | - 'default' => __('Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'uicore-elements'), | |
| 105 | - 'placeholder' => __('Enter review text', 'uicore-elements'), | |
| 106 | - ] | |
| 107 | - ); | |
| 108 | - $repeater->add_control( | |
| 109 | - 'image', | |
| 110 | - [ | |
| 111 | - 'label' => __('Secondary Image', 'uicore-elements'), | |
| 112 | - 'type' => Controls_Manager::MEDIA, | |
| 113 | - 'render_type' => 'template', | |
| 114 | - 'dynamic' => [ | |
| 115 | - 'active' => true, | |
| 116 | - ], | |
| 117 | - 'default' => [ | |
| 118 | - 'url' => Utils::get_placeholder_image_src(), | |
| 119 | - ], | |
| 120 | - ] | |
| 121 | - ); | |
| 122 | - $this->add_control( | |
| 123 | - 'review_items', | |
| 124 | - [ | |
| 125 | - 'show_label' => false, | |
| 126 | - 'type' => Controls_Manager::REPEATER, | |
| 127 | - 'fields' => $repeater->get_controls(), | |
| 128 | - 'title_field' => '{{{ reviewer_name }}}', | |
| 129 | - 'default' => [ | |
| 130 | - [ | |
| 131 | - 'reviewer_name' => __( 'Adam', 'uicore-elements' ), | |
| 132 | - 'reviewer_job_title' => __( 'SEO Expert', 'uicore-elements' ), | |
| 133 | - ], | |
| 134 | - [ | |
| 135 | - 'reviewer_name' => __( 'Karl', 'uicore-elements' ), | |
| 136 | - 'reviewer_job_title' => __( 'Designer', 'uicore-elements' ), | |
| 137 | - ], | |
| 138 | - [ | |
| 139 | - 'reviewer_name' => __( 'Maria', 'uicore-elements' ), | |
| 140 | - 'reviewer_job_title' => __( 'Developer', 'uicore-elements' ), | |
| 141 | - ], | |
| 142 | - [ | |
| 143 | - 'reviewer_name' => __( 'Michael', 'uicore-elements' ), | |
| 144 | - 'reviewer_job_title' => __( 'Manager', 'uicore-elements' ), | |
| 145 | - ], | |
| 146 | - [ | |
| 147 | - 'reviewer_name' => __( 'Lena', 'uicore-elements' ), | |
| 148 | - 'reviewer_job_title' => __( 'CEO', 'uicore-elements' ), | |
| 149 | - ], | |
| 150 | - [ | |
| 151 | - 'reviewer_name' => __( 'Jennifer', 'uicore-elements' ), | |
| 152 | - 'reviewer_job_title' => __( 'Consultant', 'uicore-elements' ), | |
| 153 | - ], | |
| 154 | - ] | |
| 155 | - ] | |
| 156 | - ); | |
| 157 | - | |
| 158 | - $this->end_controls_section(); | |
| 159 | - } | |
| 160 | - function TRAIT_register_testimonial_additional_controls() | |
| 161 | - { | |
| 162 | - $this->add_control( | |
| 163 | - 'show_reviewer_name', | |
| 164 | - [ | |
| 165 | - 'label' => __('Show Name', 'uicore-elements'), | |
| 166 | - 'type' => Controls_Manager::SWITCHER, | |
| 167 | - 'default' => 'yes', | |
| 168 | - 'separator' => 'before', | |
| 169 | - ] | |
| 170 | - ); | |
| 171 | - $this->add_control( | |
| 172 | - 'review_name_tag', | |
| 173 | - [ | |
| 174 | - 'label' => __('Name HTML Tag', 'uicore-elements'), | |
| 175 | - 'type' => Controls_Manager::SELECT, | |
| 176 | - 'default' => 'h4', | |
| 177 | - 'options' => Helper::get_title_tags(), | |
| 178 | - 'condition' => [ | |
| 179 | - 'show_reviewer_name' => 'yes', | |
| 180 | - ] | |
| 181 | - ] | |
| 182 | - ); | |
| 183 | - $this->add_control( | |
| 184 | - 'show_reviewer_job_title', | |
| 185 | - [ | |
| 186 | - 'label' => __('Show Job Title', 'uicore-elements'), | |
| 187 | - 'type' => Controls_Manager::SWITCHER, | |
| 188 | - 'default' => 'yes', | |
| 189 | - 'separator' => 'before', | |
| 190 | - ] | |
| 191 | - ); | |
| 192 | - $this->add_control( | |
| 193 | - 'show_reviewer_rating', | |
| 194 | - [ | |
| 195 | - 'label' => __('Show Rating', 'uicore-elements'), | |
| 196 | - 'type' => Controls_Manager::SWITCHER, | |
| 197 | - 'default' => 'yes', | |
| 198 | - 'separator' => 'before' | |
| 199 | - ] | |
| 200 | - ); | |
| 201 | - $this->add_control( | |
| 202 | - 'rating_type', | |
| 203 | - [ | |
| 204 | - 'label' => __( 'Rating Type', 'uicore-elements' ), | |
| 205 | - 'type' => Controls_Manager::SELECT, | |
| 206 | - 'default' => 'star', | |
| 207 | - 'options' => [ | |
| 208 | - 'star' => __( 'Star', 'uicore-elements' ), | |
| 209 | - 'number' => __( 'Number', 'uicore-elements' ), | |
| 210 | - ], | |
| 211 | - 'condition' => [ | |
| 212 | - 'show_reviewer_rating' => 'yes' | |
| 213 | - ] | |
| 214 | - ] | |
| 215 | - ); | |
| 216 | - $this->add_control( | |
| 217 | - 'show_reviewer_text', | |
| 218 | - [ | |
| 219 | - 'label' => __('Show Review Text', 'uicore-elements'), | |
| 220 | - 'type' => Controls_Manager::SWITCHER, | |
| 221 | - 'default' => 'yes', | |
| 222 | - 'separator' => 'before', | |
| 223 | - ] | |
| 224 | - ); | |
| 225 | - $this->add_control( | |
| 226 | - 'show_reviewer_image', | |
| 227 | - [ | |
| 228 | - 'label' => __('Show Image', 'uicore-elements'), | |
| 229 | - 'type' => Controls_Manager::SWITCHER, | |
| 230 | - 'default' => 'yes', | |
| 231 | - 'separator' => 'before', | |
| 232 | - ] | |
| 233 | - ); | |
| 234 | - $this->add_group_control( | |
| 235 | - Group_Control_Image_Size::get_type(), | |
| 236 | - [ | |
| 237 | - 'name' => 'image_media_size', | |
| 238 | - 'default' => 'medium', | |
| 239 | - 'condition' => [ | |
| 240 | - 'show_reviewer_image' => 'yes' | |
| 241 | - ] | |
| 242 | - ] | |
| 243 | - ); | |
| 244 | - $this->add_control( | |
| 245 | - 'show_reviewer_avatar', | |
| 246 | - [ | |
| 247 | - 'label' => __('Show Avatar', 'uicore-elements'), | |
| 248 | - 'type' => Controls_Manager::SWITCHER, | |
| 249 | - 'default' => 'yes', | |
| 250 | - 'separator' => 'before', | |
| 251 | - ] | |
| 252 | - ); | |
| 253 | - $this->add_group_control( | |
| 254 | - Group_Control_Image_Size::get_type(), | |
| 255 | - [ | |
| 256 | - 'name' => 'avatar_media_size', | |
| 257 | - 'default' => 'medium', | |
| 258 | - 'condition' => [ | |
| 259 | - 'show_reviewer_avatar' => 'yes' | |
| 260 | - ] | |
| 261 | - ] | |
| 262 | - ); | |
| 263 | - $this->add_control( | |
| 264 | - 'image_inline', | |
| 265 | - [ | |
| 266 | - 'label' => esc_html__('Image Inline', 'uicore-elements'), | |
| 267 | - 'type' => Controls_Manager::SWITCHER, | |
| 268 | - 'condition' => [ | |
| 269 | - 'show_reviewer_avatar' => 'yes' | |
| 270 | - ], | |
| 271 | - 'prefix_class' => 'ui-e-img-inline-', | |
| 272 | - 'render_type' => 'template', | |
| 273 | - 'condition' => [ | |
| 274 | - 'layout' => ['layout_1', 'layout_2', 'layout_3'], | |
| 275 | - 'show_reviewer_avatar' => 'yes' | |
| 276 | - ] | |
| 277 | - ] | |
| 278 | - ); | |
| 279 | - $this->add_responsive_control( | |
| 280 | - 'v_alignment', | |
| 281 | - [ | |
| 282 | - 'label' => __('Image Alignment', 'uicore-elements'), | |
| 283 | - 'type' => Controls_Manager::CHOOSE, | |
| 284 | - 'default' => 'flex-start', | |
| 285 | - 'toggle' => false, | |
| 286 | - 'options' => [ | |
| 287 | - 'flex-start' => [ | |
| 288 | - 'title' => __( 'Top', 'uicore-elements' ), | |
| 289 | - 'icon' => 'eicon-v-align-top', | |
| 290 | - ], | |
| 291 | - 'center' => [ | |
| 292 | - 'title' => __( 'Center', 'uicore-elements' ), | |
| 293 | - 'icon' => 'eicon-v-align-middle', | |
| 294 | - ], | |
| 295 | - 'flex-end' => [ | |
| 296 | - 'title' => __( 'Bottom', 'uicore-elements' ), | |
| 297 | - 'icon' => 'eicon-v-align-bottom', | |
| 298 | - ], | |
| 299 | - ], | |
| 300 | - 'selectors' => [ | |
| 301 | - '{{WRAPPER}} .ui-e-item' => '--ui-e-img-alignment: {{VALUE}};', | |
| 302 | - ], | |
| 303 | - 'condition' => [ | |
| 304 | - 'layout' => 'layout_6' | |
| 305 | - ], | |
| 306 | - ] | |
| 307 | - ); | |
| 308 | - $this->add_control( | |
| 309 | - 'show_reviewer_divider', | |
| 310 | - [ | |
| 311 | - 'label' => __('Show Divider', 'uicore-elements'), | |
| 312 | - 'type' => Controls_Manager::SWITCHER, | |
| 313 | - 'default' => 'yes', | |
| 314 | - 'separator' => 'before', | |
| 315 | - 'condition' => [ | |
| 316 | - 'layout' => 'layout_3' | |
| 317 | - ] | |
| 318 | - ] | |
| 319 | - ); | |
| 320 | - $this->add_responsive_control( | |
| 321 | - 'h_alignment', | |
| 322 | - [ | |
| 323 | - 'label' => __('Content Alignment', 'uicore-elements'), | |
| 324 | - 'type' => Controls_Manager::CHOOSE, | |
| 325 | - 'options' => [ | |
| 326 | - 'left' => [ | |
| 327 | - 'title' => __('Left', 'uicore-elements'), | |
| 328 | - 'icon' => 'eicon-text-align-left', | |
| 329 | - ], | |
| 330 | - 'center' => [ | |
| 331 | - 'title' => __('Center', 'uicore-elements'), | |
| 332 | - 'icon' => 'eicon-text-align-center', | |
| 333 | - ], | |
| 334 | - 'right' => [ | |
| 335 | - 'title' => __('Right', 'uicore-elements'), | |
| 336 | - 'icon' => 'eicon-text-align-right', | |
| 337 | - ], | |
| 338 | - 'justify' => [ | |
| 339 | - 'title' => __('Justified', 'uicore-elements'), | |
| 340 | - 'icon' => 'eicon-text-align-justify', | |
| 341 | - ], | |
| 342 | - ], | |
| 343 | - 'prefix_class' => 'ui-e-h-align-', | |
| 344 | - 'selectors' => [ | |
| 345 | - '{{WRAPPER}} .ui-e-item' => 'text-align: {{VALUE}};', | |
| 346 | - ], | |
| 347 | - 'separator' => 'before' | |
| 348 | - ] | |
| 349 | - ); | |
| 350 | - $this->add_responsive_control( | |
| 351 | - 'content_v_alignment', | |
| 352 | - [ | |
| 353 | - 'label' => __('Vertical Alignment', 'uicore-elements'), | |
| 354 | - 'type' => Controls_Manager::CHOOSE, | |
| 355 | - 'default' => 'center', | |
| 356 | - 'options' => [ | |
| 357 | - 'start' => [ | |
| 358 | - 'title' => __('Left', 'uicore-elements'), | |
| 359 | - 'icon' => 'eicon-align-start-v', | |
| 360 | - ], | |
| 361 | - 'center' => [ | |
| 362 | - 'title' => __('Center', 'uicore-elements'), | |
| 363 | - 'icon' => 'eicon-align-center-v', | |
| 364 | - ], | |
| 365 | - 'end' => [ | |
| 366 | - 'title' => __('Right', 'uicore-elements'), | |
| 367 | - 'icon' => 'eicon-align-end-v', | |
| 368 | - ], | |
| 369 | - ], | |
| 370 | - 'selectors' => [ | |
| 371 | - '{{WRAPPER}} .ui-e-item' => '--ui-e-content-v-alignment: {{VALUE}};', | |
| 372 | - ] | |
| 373 | - ] | |
| 374 | - ); | |
| 375 | - } | |
| 376 | - | |
| 377 | - // Style Controls Functions} | |
| 378 | - function register_testimonial_image_controls() | |
| 379 | - { | |
| 380 | - $this->start_controls_section( | |
| 381 | - 'section_style_avatar', | |
| 382 | - [ | |
| 383 | - 'label' => __('Avatar', 'uicore-elements'), | |
| 384 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 385 | - 'condition' => [ | |
| 386 | - 'show_reviewer_avatar' => 'yes' | |
| 387 | - ] | |
| 388 | - ] | |
| 389 | - ); | |
| 390 | - | |
| 391 | - $this->add_group_control( | |
| 392 | - Group_Control_Border::get_type(), | |
| 393 | - [ | |
| 394 | - 'name' => 'avatar_border', | |
| 395 | - 'selector' => '{{WRAPPER}} .ui-e-testimonial-avatar img' | |
| 396 | - ] | |
| 397 | - ); | |
| 398 | - $this->add_control( | |
| 399 | - 'avatar_radius', | |
| 400 | - [ | |
| 401 | - 'label' => esc_html__('Border Radius', 'uicore-elements'), | |
| 402 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 403 | - 'size_units' => ['px', 'em', '%'], | |
| 404 | - 'selectors' => [ | |
| 405 | - '{{WRAPPER}} .ui-e-testimonial-avatar img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 406 | - ], | |
| 407 | - ] | |
| 408 | - ); | |
| 409 | - $this->add_control( | |
| 410 | - 'avatar_padding', | |
| 411 | - [ | |
| 412 | - 'label' => __('Padding', 'uicore-elements'), | |
| 413 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 414 | - 'size_units' => ['px', 'em', '%'], | |
| 415 | - 'selectors' => [ | |
| 416 | - '{{WRAPPER}} .ui-e-testimonial-avatar img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 417 | - ], | |
| 418 | - ] | |
| 419 | - ); | |
| 420 | - $this->add_responsive_control( | |
| 421 | - 'avatar_size', | |
| 422 | - [ | |
| 423 | - 'label' => __('Size', 'uicore-elements'), | |
| 424 | - 'type' => Controls_Manager::SLIDER, | |
| 425 | - 'size_units' => [ 'px', '%' ], | |
| 426 | - 'default' => [ | |
| 427 | - 'size' => 120, | |
| 428 | - 'unit' => 'px' | |
| 429 | - ], | |
| 430 | - 'range' => [ | |
| 431 | - '%' => [ | |
| 432 | - 'min' => 1, | |
| 433 | - 'max' => 100, | |
| 434 | - ], | |
| 435 | - 'px' => [ | |
| 436 | - 'min' => 10, | |
| 437 | - 'max' => 500, | |
| 438 | - ] | |
| 439 | - ], | |
| 440 | - 'description' => __('Using `%` might make image height fits the available space, depending on layout and inline options, cutting the image. Using `px` althougt adjust the image.', 'uicore-elements'), | |
| 441 | - 'selectors' => [ | |
| 442 | - '{{WRAPPER}}' => '--ui-e-avatar-size: {{SIZE}}{{UNIT}};', | |
| 443 | - ], | |
| 444 | - 'render_type' => 'template', | |
| 445 | - 'condition' => [ | |
| 446 | - 'layout!' => 'layout_5', | |
| 447 | - ] | |
| 448 | - ] | |
| 449 | - ); | |
| 450 | - $this->add_control( | |
| 451 | - 'avatar_size_px', | |
| 452 | - [ | |
| 453 | - 'label' => __('Size', 'uicore-elements'), | |
| 454 | - 'type' => Controls_Manager::SLIDER, | |
| 455 | - 'default' => [ | |
| 456 | - 'size' => 80, | |
| 457 | - 'unit' => 'px' | |
| 458 | - ], | |
| 459 | - 'range' => [ | |
| 460 | - 'px' => [ | |
| 461 | - 'min' => 1, | |
| 462 | - 'max' => 250, | |
| 463 | - ], | |
| 464 | - ], | |
| 465 | - 'selectors' => [ | |
| 466 | - '{{WRAPPER}}' => '--ui-e-avatar-size: {{SIZE}}{{UNIT}};', | |
| 467 | - ], | |
| 468 | - 'condition' => [ | |
| 469 | - 'layout' => 'layout_5', | |
| 470 | - ] | |
| 471 | - ] | |
| 472 | - ); | |
| 473 | - $this->add_control( | |
| 474 | - 'avatar_spacing', | |
| 475 | - [ | |
| 476 | - 'label' => __('Spacing', 'uicore-elements'), | |
| 477 | - 'type' => Controls_Manager::SLIDER, | |
| 478 | - 'default' => [ | |
| 479 | - 'size' => 15, | |
| 480 | - ], | |
| 481 | - 'selectors' => [ | |
| 482 | - '{{WRAPPER}}' => '--ui-e-avatar-spacing: {{SIZE}}{{UNIT}}' | |
| 483 | - ], | |
| 484 | - ] | |
| 485 | - ); | |
| 486 | - $this->add_group_control( | |
| 487 | - Group_Control_Box_Shadow::get_type(), | |
| 488 | - [ | |
| 489 | - 'name' => 'avatar_shadow', | |
| 490 | - 'selector' => '{{WRAPPER}} .ui-e-testimonial-avatar img' | |
| 491 | - ] | |
| 492 | - ); | |
| 493 | - $this->add_control( | |
| 494 | - 'avatar_offset_toggle', | |
| 495 | - [ | |
| 496 | - 'label' => __('Offset', 'uicore-elements'), | |
| 497 | - 'type' => Controls_Manager::POPOVER_TOGGLE, | |
| 498 | - 'label_off' => __('None', 'uicore-elements'), | |
| 499 | - 'label_on' => __('Custom', 'uicore-elements'), | |
| 500 | - 'return_value' => 'yes', | |
| 501 | - ] | |
| 502 | - ); | |
| 503 | - $this->start_popover(); | |
| 504 | - | |
| 505 | - $this->add_responsive_control( | |
| 506 | - 'avatar_horizontal_offset', | |
| 507 | - [ | |
| 508 | - 'label' => __('Horizontal', 'uicore-elements'), | |
| 509 | - 'type' => Controls_Manager::SLIDER, | |
| 510 | - 'default' => [ | |
| 511 | - 'size' => 0, | |
| 512 | - ], | |
| 513 | - 'tablet_default' => [ | |
| 514 | - 'size' => 0, | |
| 515 | - ], | |
| 516 | - 'mobile_default' => [ | |
| 517 | - 'size' => 0, | |
| 518 | - ], | |
| 519 | - 'range' => [ | |
| 520 | - 'px' => [ | |
| 521 | - 'min' => -200, | |
| 522 | - 'max' => 200, | |
| 523 | - ], | |
| 524 | - ], | |
| 525 | - 'condition' => [ | |
| 526 | - 'avatar_offset_toggle' => 'yes' | |
| 527 | - ], | |
| 528 | - 'render_type' => 'ui', | |
| 529 | - 'selectors' => [ | |
| 530 | - '{{WRAPPER}}' => '--ui-e-avatar-h-offset: {{SIZE}}px;' | |
| 531 | - ], | |
| 532 | - ] | |
| 533 | - ); | |
| 534 | - $this->add_responsive_control( | |
| 535 | - 'avatar_vertical_offset', | |
| 536 | - [ | |
| 537 | - 'label' => __('Vertical', 'uicore-elements'), | |
| 538 | - 'type' => Controls_Manager::SLIDER, | |
| 539 | - 'default' => [ | |
| 540 | - 'size' => 0, | |
| 541 | - ], | |
| 542 | - 'tablet_default' => [ | |
| 543 | - 'size' => 0, | |
| 544 | - ], | |
| 545 | - 'mobile_default' => [ | |
| 546 | - 'size' => 0, | |
| 547 | - ], | |
| 548 | - 'range' => [ | |
| 549 | - 'px' => [ | |
| 550 | - 'min' => -200, | |
| 551 | - 'max' => 200, | |
| 552 | - ], | |
| 553 | - ], | |
| 554 | - 'condition' => [ | |
| 555 | - 'avatar_offset_toggle' => 'yes' | |
| 556 | - ], | |
| 557 | - 'render_type' => 'ui', | |
| 558 | - 'selectors' => [ | |
| 559 | - '{{WRAPPER}}' => '--ui-e-avatar-v-offset: {{SIZE}}px;' | |
| 560 | - ], | |
| 561 | - ] | |
| 562 | - ); | |
| 563 | - $this->end_popover(); | |
| 564 | - | |
| 565 | - $this->end_controls_section(); | |
| 566 | - $this->start_controls_section( | |
| 567 | - 'section_style_image', | |
| 568 | - [ | |
| 569 | - 'label' => __('Secondary Image', 'uicore-elements'), | |
| 570 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 571 | - 'condition' => [ | |
| 572 | - 'show_reviewer_image' => 'yes' | |
| 573 | - ] | |
| 574 | - ] | |
| 575 | - ); | |
| 576 | - $this->add_control( | |
| 577 | - 'image_size', | |
| 578 | - [ | |
| 579 | - 'label' => __('Size', 'uicore-elements'), | |
| 580 | - 'type' => Controls_Manager::SLIDER, | |
| 581 | - 'default' => [ | |
| 582 | - 'size' => 40, | |
| 583 | - 'unit' => 'px' | |
| 584 | - ], | |
| 585 | - 'range' => [ | |
| 586 | - 'px' => [ | |
| 587 | - 'min' => 10, | |
| 588 | - 'max' => 500, | |
| 589 | - ], | |
| 590 | - ], | |
| 591 | - 'selectors' => [ | |
| 592 | - '{{WRAPPER}}' => '--ui-e-image-size: {{SIZE}}{{UNIT}};', | |
| 593 | - ], | |
| 594 | - ] | |
| 595 | - ); | |
| 596 | - $this->add_control( | |
| 597 | - 'image_spacing', | |
| 598 | - [ | |
| 599 | - 'label' => __('Spacing', 'uicore-elements'), | |
| 600 | - 'type' => Controls_Manager::SLIDER, | |
| 601 | - 'default' => [ | |
| 602 | - 'size' => 15, | |
| 603 | - ], | |
| 604 | - 'selectors' => [ | |
| 605 | - '{{WRAPPER}}' => '--ui-e-img-spacing: {{SIZE}}{{UNIT}}' | |
| 606 | - ], | |
| 607 | - 'condition' => [ | |
| 608 | - 'layout!' => ['layout_2', 'layout_4', 'layout_6'], | |
| 609 | - ] | |
| 610 | - ] | |
| 611 | - ); | |
| 612 | - $this->add_control( | |
| 613 | - 'image_offset_toggle', | |
| 614 | - [ | |
| 615 | - 'label' => __('Offset', 'uicore-elements'), | |
| 616 | - 'type' => Controls_Manager::POPOVER_TOGGLE, | |
| 617 | - 'label_off' => __('None', 'uicore-elements'), | |
| 618 | - 'label_on' => __('Custom', 'uicore-elements'), | |
| 619 | - 'return_value' => 'yes', | |
| 620 | - ] | |
| 621 | - ); | |
| 622 | - $this->start_popover(); | |
| 623 | - | |
| 624 | - $this->add_responsive_control( | |
| 625 | - 'image_horizontal_offset', | |
| 626 | - [ | |
| 627 | - 'label' => __('Horizontal', 'uicore-elements'), | |
| 628 | - 'type' => Controls_Manager::SLIDER, | |
| 629 | - 'default' => [ | |
| 630 | - 'size' => 0, | |
| 631 | - ], | |
| 632 | - 'tablet_default' => [ | |
| 633 | - 'size' => 0, | |
| 634 | - ], | |
| 635 | - 'mobile_default' => [ | |
| 636 | - 'size' => 0, | |
| 637 | - ], | |
| 638 | - 'range' => [ | |
| 639 | - 'px' => [ | |
| 640 | - 'min' => -200, | |
| 641 | - 'max' => 200, | |
| 642 | - ], | |
| 643 | - ], | |
| 644 | - 'condition' => [ | |
| 645 | - 'image_offset_toggle' => 'yes' | |
| 646 | - ], | |
| 647 | - 'render_type' => 'ui', | |
| 648 | - 'selectors' => [ | |
| 649 | - '{{WRAPPER}}' => '--ui-e-img-h-offset: {{SIZE}}px;' | |
| 650 | - ], | |
| 651 | - ] | |
| 652 | - ); | |
| 653 | - $this->add_responsive_control( | |
| 654 | - 'image_vertical_offset', | |
| 655 | - [ | |
| 656 | - 'label' => __('Vertical', 'uicore-elements'), | |
| 657 | - 'type' => Controls_Manager::SLIDER, | |
| 658 | - 'default' => [ | |
| 659 | - 'size' => 0, | |
| 660 | - ], | |
| 661 | - 'tablet_default' => [ | |
| 662 | - 'size' => 0, | |
| 663 | - ], | |
| 664 | - 'mobile_default' => [ | |
| 665 | - 'size' => 0, | |
| 666 | - ], | |
| 667 | - 'range' => [ | |
| 668 | - 'px' => [ | |
| 669 | - 'min' => -200, | |
| 670 | - 'max' => 200, | |
| 671 | - ], | |
| 672 | - ], | |
| 673 | - 'condition' => [ | |
| 674 | - 'image_offset_toggle' => 'yes' | |
| 675 | - ], | |
| 676 | - 'render_type' => 'ui', | |
| 677 | - 'selectors' => [ | |
| 678 | - '{{WRAPPER}}' => '--ui-e-img-v-offset: {{SIZE}}px;' | |
| 679 | - ], | |
| 680 | - ] | |
| 681 | - ); | |
| 682 | - $this->end_popover(); | |
| 683 | - $this->end_controls_section(); | |
| 684 | - } | |
| 685 | - function register_testimonial_name_controls() | |
| 686 | - { | |
| 687 | - $this->start_controls_section( | |
| 688 | - 'section_style_name', | |
| 689 | - [ | |
| 690 | - 'label' => __('Name', 'uicore-elements'), | |
| 691 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 692 | - 'condition' => [ | |
| 693 | - 'show_reviewer_name' => 'yes', | |
| 694 | - ] | |
| 695 | - ] | |
| 696 | - ); | |
| 697 | - | |
| 698 | - $this->add_control( | |
| 699 | - 'name_color', | |
| 700 | - [ | |
| 701 | - 'label' => __('Color', 'uicore-elements'), | |
| 702 | - 'type' => Controls_Manager::COLOR, | |
| 703 | - 'selectors' => [ | |
| 704 | - '{{WRAPPER}} .ui-e-testimonial-name' => 'color: {{VALUE}};', | |
| 705 | - ], | |
| 706 | - ] | |
| 707 | - ); | |
| 708 | - $this->add_control( | |
| 709 | - 'name_hover_color', | |
| 710 | - [ | |
| 711 | - 'label' => __('Hover Color', 'uicore-elements'), | |
| 712 | - 'type' => Controls_Manager::COLOR, | |
| 713 | - 'selectors' => [ | |
| 714 | - '{{WRAPPER}} .ui-e-item:hover .ui-e-testimonial-name' => 'color: {{VALUE}};', | |
| 715 | - ], | |
| 716 | - ] | |
| 717 | - ); | |
| 718 | - $this->add_control( | |
| 719 | - 'name_bottom_space', | |
| 720 | - [ | |
| 721 | - 'label' => __('Spacing', 'uicore-elements'), | |
| 722 | - 'type' => Controls_Manager::SLIDER, | |
| 723 | - 'range' => [ | |
| 724 | - 'px' => [ | |
| 725 | - 'min' => 0, | |
| 726 | - 'max' => 100, | |
| 727 | - ], | |
| 728 | - ], | |
| 729 | - 'selectors' => [ | |
| 730 | - '{{WRAPPER}} .ui-e-testimonial-name' => 'padding-bottom: {{SIZE}}{{UNIT}};', | |
| 731 | - ], | |
| 732 | - ] | |
| 733 | - ); | |
| 734 | - $this->add_group_control( | |
| 735 | - Group_Control_Typography::get_type(), | |
| 736 | - [ | |
| 737 | - 'name' => 'name_typography', | |
| 738 | - 'selector' => '{{WRAPPER}} .ui-e-testimonial-name', | |
| 739 | - ] | |
| 740 | - ); | |
| 741 | - $this->add_group_control( | |
| 742 | - Group_Control_Text_Shadow::get_type(), | |
| 743 | - [ | |
| 744 | - 'name' => 'name_shadow', | |
| 745 | - 'label' => __( 'Text Shadow', 'uicore-elements' ), | |
| 746 | - 'selector' => '{{WRAPPER}} .ui-e-testimonial-name', | |
| 747 | - ] | |
| 748 | - ); | |
| 749 | - | |
| 750 | - $this->end_controls_section(); | |
| 751 | - } | |
| 752 | - function register_testimonial_job_controls() | |
| 753 | - { | |
| 754 | - $this->start_controls_section( | |
| 755 | - 'section_style_job_title', | |
| 756 | - [ | |
| 757 | - 'label' => __('Job Title', 'uicore-elements'), | |
| 758 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 759 | - 'condition' => [ | |
| 760 | - 'show_reviewer_job_title' => 'yes', | |
| 761 | - ] | |
| 762 | - ] | |
| 763 | - ); | |
| 764 | - | |
| 765 | - $this->add_control( | |
| 766 | - 'job_title_color', | |
| 767 | - [ | |
| 768 | - 'label' => __('Color', 'uicore-elements'), | |
| 769 | - 'type' => Controls_Manager::COLOR, | |
| 770 | - 'selectors' => [ | |
| 771 | - '{{WRAPPER}} .ui-e-testimonial-job-title' => 'color: {{VALUE}};', | |
| 772 | - ], | |
| 773 | - ] | |
| 774 | - ); | |
| 775 | - $this->add_control( | |
| 776 | - 'job_title_hover_color', | |
| 777 | - [ | |
| 778 | - 'label' => __('Hover Color', 'uicore-elements'), | |
| 779 | - 'type' => Controls_Manager::COLOR, | |
| 780 | - 'selectors' => [ | |
| 781 | - '{{WRAPPER}} .ui-e-item:hover .ui-e-testimonial-job-title' => 'color: {{VALUE}};', | |
| 782 | - ], | |
| 783 | - ] | |
| 784 | - ); | |
| 785 | - $this->add_control( | |
| 786 | - 'job_title_bottom_space', | |
| 787 | - [ | |
| 788 | - 'label' => __('Spacing', 'uicore-elements'), | |
| 789 | - 'type' => Controls_Manager::SLIDER, | |
| 790 | - 'range' => [ | |
| 791 | - 'px' => [ | |
| 792 | - 'min' => 0, | |
| 793 | - 'max' => 100, | |
| 794 | - ], | |
| 795 | - ], | |
| 796 | - 'default' => [ | |
| 797 | - 'size' => 10, | |
| 798 | - 'unit' => 'px' | |
| 799 | - ], | |
| 800 | - 'selectors' => [ | |
| 801 | - '{{WRAPPER}} .ui-e-testimonial-job-title' => 'padding-bottom: {{SIZE}}{{UNIT}};', | |
| 802 | - ], | |
| 803 | - ] | |
| 804 | - ); | |
| 805 | - $this->add_group_control( | |
| 806 | - Group_Control_Typography::get_type(), | |
| 807 | - [ | |
| 808 | - 'name' => 'job_title_typography', | |
| 809 | - 'selector' => '{{WRAPPER}} .ui-e-testimonial-job-title', | |
| 810 | - ] | |
| 811 | - ); | |
| 812 | - | |
| 813 | - $this->end_controls_section(); | |
| 814 | - } | |
| 815 | - function register_testimonial_text_controls() | |
| 816 | - { | |
| 817 | - $this->start_controls_section( | |
| 818 | - 'section_style_text', | |
| 819 | - [ | |
| 820 | - 'label' => __('Text', 'uicore-elements'), | |
| 821 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 822 | - 'condition' => [ | |
| 823 | - 'show_reviewer_text' => 'yes', | |
| 824 | - ] | |
| 825 | - ] | |
| 826 | - ); | |
| 827 | - | |
| 828 | - $this->add_control( | |
| 829 | - 'text_color', | |
| 830 | - [ | |
| 831 | - 'label' => __('Color', 'uicore-elements'), | |
| 832 | - 'type' => Controls_Manager::COLOR, | |
| 833 | - 'selectors' => [ | |
| 834 | - '{{WRAPPER}} .ui-e-testimonial-text' => 'color: {{VALUE}};', | |
| 835 | - ], | |
| 836 | - ] | |
| 837 | - ); | |
| 838 | - $this->add_control( | |
| 839 | - 'text_hover_color', | |
| 840 | - [ | |
| 841 | - 'label' => __('Hover Color', 'uicore-elements'), | |
| 842 | - 'type' => Controls_Manager::COLOR, | |
| 843 | - 'selectors' => [ | |
| 844 | - '{{WRAPPER}} .ui-e-item:hover .ui-e-testimonial-text' => 'color: {{VALUE}};', | |
| 845 | - ], | |
| 846 | - ] | |
| 847 | - ); | |
| 848 | - $this->add_group_control( | |
| 849 | - Group_Control_Typography::get_type(), | |
| 850 | - [ | |
| 851 | - 'name' => 'text_typography', | |
| 852 | - 'selector' => '{{WRAPPER}} .ui-e-testimonial-text', | |
| 853 | - ] | |
| 854 | - ); | |
| 855 | - $this->add_control( | |
| 856 | - 'text_bottom_space', | |
| 857 | - [ | |
| 858 | - 'label' => __('Spacing', 'uicore-elements'), | |
| 859 | - 'type' => Controls_Manager::SLIDER, | |
| 860 | - 'range' => [ | |
| 861 | - 'px' => [ | |
| 862 | - 'min' => 0, | |
| 863 | - 'max' => 100, | |
| 864 | - ], | |
| 865 | - ], | |
| 866 | - 'default' => [ | |
| 867 | - 'size' => 15, | |
| 868 | - 'unit' => 'px' | |
| 869 | - ], | |
| 870 | - 'selectors' => [ | |
| 871 | - '{{WRAPPER}} .ui-e-testimonial-text' => 'padding-bottom: {{SIZE}}{{UNIT}};', | |
| 872 | - ], | |
| 873 | - ] | |
| 874 | - ); | |
| 875 | - | |
| 876 | - $this->end_controls_section(); | |
| 877 | - } | |
| 878 | - function register_testimonial_rating_controls() | |
| 879 | - { | |
| 880 | - $this->start_controls_section( | |
| 881 | - 'section_style_rating', | |
| 882 | - [ | |
| 883 | - 'label' => esc_html__('Rating', 'uicore-elements'), | |
| 884 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 885 | - 'condition' => [ | |
| 886 | - 'show_reviewer_rating' => 'yes', | |
| 887 | - ], | |
| 888 | - ] | |
| 889 | - ); | |
| 890 | - | |
| 891 | - // If SVG inline, we only need one color control because the semi-star bg color hack is not enabled with this experiment | |
| 892 | - if(Plugin::$instance->experiments->is_feature_active('e_font_icon_svg')) { | |
| 893 | - $this->add_control( | |
| 894 | - 'active_rating_color', | |
| 895 | - [ | |
| 896 | - 'label' => esc_html__('Color', 'uicore-elements'), | |
| 897 | - 'type' => Controls_Manager::COLOR, | |
| 898 | - 'default' => '#ffab1a', | |
| 899 | - 'selectors' => [ | |
| 900 | - '{{WRAPPER}} .ui-e-testimonial-rating svg' => 'fill: {{VALUE}};', | |
| 901 | - ], | |
| 902 | - 'condition' => [ | |
| 903 | - 'rating_type' => 'star', | |
| 904 | - ], | |
| 905 | - ] | |
| 906 | - ); | |
| 907 | - // Without the experiment, two colors are usefull because <i> elements can be cut and printed as decimal-stars | |
| 908 | - } else { | |
| 909 | - $this->add_control( | |
| 910 | - 'active_rating_color', | |
| 911 | - [ | |
| 912 | - 'label' => esc_html__('Active Color', 'uicore-elements'), | |
| 913 | - 'type' => Controls_Manager::COLOR, | |
| 914 | - 'default' => '#ffab1a', | |
| 915 | - 'selectors' => [ | |
| 916 | - '{{WRAPPER}} .ui-e-testimonial-rating .ui-e-marked i' => 'color: {{VALUE}};', | |
| 917 | - ], | |
| 918 | - 'condition' => [ | |
| 919 | - 'rating_type' => 'star', | |
| 920 | - ], | |
| 921 | - ] | |
| 922 | - ); | |
| 923 | - $this->add_control( | |
| 924 | - 'rating_color', | |
| 925 | - [ | |
| 926 | - 'label' => esc_html__('Color', 'uicore-elements'), | |
| 927 | - 'type' => Controls_Manager::COLOR, | |
| 928 | - 'default' => '#ccd6df', | |
| 929 | - 'selectors' => [ | |
| 930 | - '{{WRAPPER}} .ui-e-testimonial-rating .ui-e-unmarked i' => 'color: {{VALUE}};', | |
| 931 | - ], | |
| 932 | - 'condition' => [ | |
| 933 | - 'rating_type' => 'star', | |
| 934 | - ], | |
| 935 | - ] | |
| 936 | - ); | |
| 937 | - } | |
| 938 | - $this->add_control( | |
| 939 | - 'rating_number_color', | |
| 940 | - [ | |
| 941 | - 'label' => esc_html__('Color', 'uicore-elements'), | |
| 942 | - 'type' => Controls_Manager::COLOR, | |
| 943 | - 'selectors' => [ | |
| 944 | - '{{WRAPPER}} .ui-e-testimonial-rating' => 'color: {{VALUE}};', | |
| 945 | - ], | |
| 946 | - 'condition' => [ | |
| 947 | - 'rating_type' => 'number', | |
| 948 | - ], | |
| 949 | - ] | |
| 950 | - ); | |
| 951 | - $this->add_control( | |
| 952 | - 'rating_background', | |
| 953 | - [ | |
| 954 | - 'label' => __( 'Background Color', 'uicore-elements' ), | |
| 955 | - 'type' => Controls_Manager::COLOR, | |
| 956 | - 'selectors' => [ | |
| 957 | - '{{WRAPPER}} .ui-e-testimonial-rating' => 'background-color: {{VALUE}};', | |
| 958 | - ], | |
| 959 | - 'condition' => [ | |
| 960 | - 'rating_type' => 'star', | |
| 961 | - ], | |
| 962 | - ] | |
| 963 | - ); | |
| 964 | - $this->add_control( | |
| 965 | - 'rating_number_background', | |
| 966 | - [ | |
| 967 | - 'label' => __( 'Background Color', 'uicore-elements' ), | |
| 968 | - 'type' => Controls_Manager::COLOR, | |
| 969 | - 'selectors' => [ | |
| 970 | - '{{WRAPPER}} .ui-e-testimonial-rating' => 'background-color: {{VALUE}};', | |
| 971 | - ], | |
| 972 | - 'global' => [ | |
| 973 | - 'default' => Global_Colors::COLOR_PRIMARY, | |
| 974 | - ], | |
| 975 | - 'condition' => [ | |
| 976 | - 'rating_type' => 'number', | |
| 977 | - ], | |
| 978 | - ] | |
| 979 | - ); | |
| 980 | - | |
| 981 | - $this->add_group_control( | |
| 982 | - Group_Control_Border::get_type(), | |
| 983 | - [ | |
| 984 | - 'name' => 'rating_border', | |
| 985 | - 'selector' => '{{WRAPPER}} .ui-e-testimonial-rating', | |
| 986 | - ] | |
| 987 | - ); | |
| 988 | - $this->add_control( | |
| 989 | - 'rating_border_radius', | |
| 990 | - [ | |
| 991 | - 'label' => __( 'Border Radius', 'uicore-elements' ), | |
| 992 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 993 | - 'size_units' => [ 'px', 'em', '%' ], | |
| 994 | - 'selectors' => [ | |
| 995 | - '{{WRAPPER}} .ui-e-testimonial-rating' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 996 | - ], | |
| 997 | - ] | |
| 998 | - ); | |
| 999 | - $this->add_control( | |
| 1000 | - 'rating_padding', | |
| 1001 | - [ | |
| 1002 | - 'label' => esc_html__('Padding', 'uicore-elements'), | |
| 1003 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 1004 | - 'size_units' => ['px', 'em', '%'], | |
| 1005 | - 'selectors' => [ | |
| 1006 | - '{{WRAPPER}} .ui-e-testimonial-rating' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1007 | - ], | |
| 1008 | - ] | |
| 1009 | - ); | |
| 1010 | - $this->add_control( | |
| 1011 | - 'rating_margin', | |
| 1012 | - [ | |
| 1013 | - 'label' => esc_html__('Margin', 'uicore-elements'), | |
| 1014 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 1015 | - 'size_units' => ['px', '%'], | |
| 1016 | - 'selectors' => [ | |
| 1017 | - '{{WRAPPER}} .ui-e-testimonial-rating' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1018 | - ], | |
| 1019 | - ] | |
| 1020 | - ); | |
| 1021 | - $this->add_control( | |
| 1022 | - 'rating_size', | |
| 1023 | - [ | |
| 1024 | - 'label' => esc_html__('Size', 'uicore-elements'), | |
| 1025 | - 'type' => Controls_Manager::SLIDER, | |
| 1026 | - 'default' => [ | |
| 1027 | - 'size' => 14, | |
| 1028 | - 'unit' => 'px' | |
| 1029 | - ], | |
| 1030 | - 'selectors' => [ | |
| 1031 | - '{{WRAPPER}} .ui-e-testimonial-rating' => 'font-size: {{SIZE}}{{UNIT}};', | |
| 1032 | - '{{WRAPPER}} .ui-e-testimonial-rating svg' => 'width: {{SIZE}}{{UNIT}};', | |
| 1033 | - ], | |
| 1034 | - ] | |
| 1035 | - ); | |
| 1036 | - $this->add_control( | |
| 1037 | - 'rating_space_between', | |
| 1038 | - [ | |
| 1039 | - 'label' => esc_html__('Space Between', 'uicore-elements'), | |
| 1040 | - 'type' => Controls_Manager::SLIDER, | |
| 1041 | - 'range' => [ | |
| 1042 | - 'px' => [ | |
| 1043 | - 'min' => 0, | |
| 1044 | - 'max' => 10, | |
| 1045 | - ], | |
| 1046 | - ], | |
| 1047 | - 'selectors' => [ | |
| 1048 | - '{{WRAPPER}} .ui-e-testimonial-rating .ui-e-icon + .ui-e-icon' => 'margin-left: {{SIZE}}{{UNIT}};', // star type | |
| 1049 | - '{{WRAPPER}} .ui-e-testimonial-rating span' => 'margin-right: {{SIZE}}{{UNIT}};', // number type | |
| 1050 | - ], | |
| 1051 | - 'condition' => [ | |
| 1052 | - 'rating_type' => 'star', | |
| 1053 | - ], | |
| 1054 | - ] | |
| 1055 | - ); | |
| 1056 | - | |
| 1057 | - $this->end_controls_section(); | |
| 1058 | - } | |
| 1059 | - function register_testimonial_divider_controls() | |
| 1060 | - { | |
| 1061 | - $this->start_controls_section( | |
| 1062 | - 'section_style_divider', | |
| 1063 | - [ | |
| 1064 | - 'label' => __('Divider', 'uicore-elements'), | |
| 1065 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 1066 | - 'condition' => [ | |
| 1067 | - 'layout' => 'layout_3', | |
| 1068 | - 'show_reviewer_divider' => 'yes' | |
| 1069 | - ] | |
| 1070 | - ] | |
| 1071 | - ); | |
| 1072 | - | |
| 1073 | - $this->add_control( | |
| 1074 | - 'divider_color', | |
| 1075 | - [ | |
| 1076 | - 'label' => __('Color', 'uicore-elements'), | |
| 1077 | - 'type' => Controls_Manager::COLOR, | |
| 1078 | - 'selectors' => [ | |
| 1079 | - '{{WRAPPER}} .ui-e-testimonial-divider' => 'border-color: {{VALUE}};', | |
| 1080 | - ], | |
| 1081 | - ] | |
| 1082 | - ); | |
| 1083 | - $this->add_control( | |
| 1084 | - 'divider_spacing', | |
| 1085 | - [ | |
| 1086 | - 'label' => __('Spacing', 'uicore-elements'), | |
| 1087 | - 'type' => Controls_Manager::SLIDER, | |
| 1088 | - 'default' => [ | |
| 1089 | - 'size' => 20, | |
| 1090 | - 'unit' => 'px' | |
| 1091 | - ], | |
| 1092 | - 'selectors' => [ | |
| 1093 | - '{{WRAPPER}} .ui-e-testimonial-divider' => 'margin-bottom: {{SIZE}}{{UNIT}};', | |
| 1094 | - ], | |
| 1095 | - ] | |
| 1096 | - ); | |
| 1097 | - | |
| 1098 | - $this->end_controls_section(); | |
| 1099 | - } | |
| 1100 | - | |
| 1101 | - // Register all Style Controls at once but Cards Controls since different widgets may/may not require an 'active' state | |
| 1102 | - function TRAIT_register_style_controls() | |
| 1103 | - { | |
| 1104 | - $this->register_testimonial_image_controls(); | |
| 1105 | - $this->register_testimonial_name_controls(); | |
| 1106 | - $this->register_testimonial_job_controls(); | |
| 1107 | - $this->register_testimonial_text_controls(); | |
| 1108 | - $this->register_testimonial_rating_controls(); | |
| 1109 | - $this->register_testimonial_divider_controls(); | |
| 1110 | - } | |
| 1111 | - // Register all Animation Controls at once | |
| 1112 | - function TRAIT_register_testimonial_animation_controls() | |
| 1113 | - { | |
| 1114 | - $this->TRAIT_register_entrance_animations_controls(); // animate each item | |
| 1115 | - // Hover Animations -- IMPORTANT: any new animation added here must also be added on condition list to the animation wrapper at TRAIT_render_review_item() | |
| 1116 | - $this->TRAIT_register_hover_animation_control( | |
| 1117 | - 'Item Hover Animation', | |
| 1118 | - [], | |
| 1119 | - ['underline'] | |
| 1120 | - ); | |
| 1121 | - $this->TRAIT_register_hover_animation_control( | |
| 1122 | - 'Image Animations', | |
| 1123 | - ['show_reviewer_image' => 'yes'], | |
| 1124 | - ['underline'] | |
| 1125 | - ); | |
| 1126 | - $this->TRAIT_register_hover_animation_control( | |
| 1127 | - 'Avatar Animations', | |
| 1128 | - ['show_reviewer_avatar' => 'yes'], | |
| 1129 | - ['underline'] | |
| 1130 | - ); | |
| 1131 | - $this->TRAIT_register_hover_animation_control( | |
| 1132 | - 'Text Animations', | |
| 1133 | - ['show_reviewer_text' => 'yes'], | |
| 1134 | - ['zoom', 'underline'] | |
| 1135 | - ); | |
| 1136 | - $this->TRAIT_register_hover_animation_control( | |
| 1137 | - 'Name Animations', | |
| 1138 | - ['show_reviewer_name' => 'yes'], | |
| 1139 | - ['zoom'] | |
| 1140 | - ); | |
| 1141 | - $this->TRAIT_register_hover_animation_control( | |
| 1142 | - 'Job Animations', | |
| 1143 | - ['show_reviewer_job_title' => 'yes'], | |
| 1144 | - ['zoom'] | |
| 1145 | - ); | |
| 1146 | - $this->TRAIT_register_hover_animation_control( | |
| 1147 | - 'Rating Animations', | |
| 1148 | - ['show_reviewer_rating' => 'yes'], | |
| 1149 | - ['underline'] | |
| 1150 | - ); | |
| 1151 | - } | |
| 1152 | - // Register specific Controls that can't be called in blocks because are positioned differently on widgets, or used only by specific testimonial types, such as grid or carousel | |
| 1153 | - function TRAIT_register_specific_testimonial_controls($arg) | |
| 1154 | - { | |
| 1155 | - | |
| 1156 | - switch ($arg){ | |
| 1157 | - case 'layout' : | |
| 1158 | - $this->add_control( | |
| 1159 | - 'layout', | |
| 1160 | - [ | |
| 1161 | - 'label' => esc_html__( 'Layout', 'uicore-elements' ), | |
| 1162 | - 'type' => Controls_Manager::SELECT, | |
| 1163 | - 'default' => 'layout_1', | |
| 1164 | - 'options' => [ | |
| 1165 | - 'layout_1' => esc_html__( 'Layout 1', 'uicore-elements' ), | |
| 1166 | - 'layout_2' => esc_html__( 'Layout 2', 'uicore-elements' ), | |
| 1167 | - 'layout_3' => esc_html__( 'Layout 3', 'uicore-elements' ), | |
| 1168 | - 'layout_4' => esc_html__( 'Layout 4', 'uicore-elements' ), | |
| 1169 | - 'layout_5' => esc_html__( 'Layout 5', 'uicore-elements' ), | |
| 1170 | - 'layout_6' => esc_html__( 'Layout 6', 'uicore-elements' ), | |
| 1171 | - ], | |
| 1172 | - 'render_type' => 'template', | |
| 1173 | - 'prefix_class' => 'ui-e-', | |
| 1174 | - 'frontend_available' => true | |
| 1175 | - ] | |
| 1176 | - ); | |
| 1177 | - break; | |
| 1178 | - | |
| 1179 | - case 'item_animations' : | |
| 1180 | - $this->add_control( | |
| 1181 | - 'item_hover_animation', | |
| 1182 | - [ | |
| 1183 | - 'label' => esc_html__( 'Item Hover Animation', 'uicore-elements' ), | |
| 1184 | - 'type' => Controls_Manager::SELECT, | |
| 1185 | - 'default' => '', | |
| 1186 | - 'label_block' => true, | |
| 1187 | - 'options' => $this->get_animations(), | |
| 1188 | - ] | |
| 1189 | - ); | |
| 1190 | - break; | |
| 1191 | - } | |
| 1192 | - | |
| 1193 | - } | |
| 1194 | - | |
| 1195 | - // HTML Rendering Functions | |
| 1196 | - function render_reviewer_avatar($item) | |
| 1197 | - { | |
| 1198 | - $settings = $this->get_settings_for_display(); | |
| 1199 | - $fit_avatar = ( isset($settings['avatar_size']) && $settings['avatar_size']['unit'] === 'px' ) ? 'ui-avatar-fit' : ''; | |
| 1200 | - | |
| 1201 | - if ( ! $settings['show_reviewer_avatar'] ) { | |
| 1202 | - return; | |
| 1203 | - } | |
| 1204 | - | |
| 1205 | - ?> | |
| 1206 | - <div class="ui-e-testimonial-avatar <?php esc_attr_e($settings['avatar_animations']); echo esc_attr($fit_avatar);?>"> | |
| 1207 | - <?php | |
| 1208 | - $avatar_url = Group_Control_Image_Size::get_attachment_image_src($item['avatar']['id'], 'avatar_media_size', $settings); | |
| 1209 | - if (!$avatar_url) { | |
| 1210 | - printf('<img src="%1$s" alt="%2$s">', $item['avatar']['url'], esc_html($item['reviewer_name'])); | |
| 1211 | - } else { | |
| 1212 | - print(wp_get_attachment_image( | |
| 1213 | - $item['avatar']['id'], | |
| 1214 | - $settings['avatar_media_size_size'], | |
| 1215 | - false, | |
| 1216 | - [ | |
| 1217 | - 'alt' => esc_html($item['reviewer_name']) | |
| 1218 | - ] | |
| 1219 | - )); | |
| 1220 | - } | |
| 1221 | - ?> | |
| 1222 | - </div> | |
| 1223 | - <?php | |
| 1224 | - } | |
| 1225 | - function render_reviewer_secondary_image($item) | |
| 1226 | - { | |
| 1227 | - $settings = $this->get_settings_for_display(); | |
| 1228 | - | |
| 1229 | - $thumb_url = Group_Control_Image_Size::get_attachment_image_src($item['image']['id'], 'image_media_size', $settings); | |
| 1230 | - | |
| 1231 | - if ( ! $settings['show_reviewer_image'] || !$thumb_url ) { | |
| 1232 | - return; | |
| 1233 | - } | |
| 1234 | - | |
| 1235 | - ?> | |
| 1236 | - <div class="ui-e-testimonial-image <?php esc_attr_e($settings['image_animations']);?>"> | |
| 1237 | - <?php | |
| 1238 | - if ($thumb_url) { | |
| 1239 | - print(wp_get_attachment_image( | |
| 1240 | - $item['image']['id'], | |
| 1241 | - $settings['image_media_size_size'], | |
| 1242 | - false, | |
| 1243 | - [] | |
| 1244 | - )); | |
| 1245 | - } | |
| 1246 | - ?> | |
| 1247 | - </div> | |
| 1248 | - <?php | |
| 1249 | - } | |
| 1250 | - function render_reviewer_name($item) | |
| 1251 | - { | |
| 1252 | - $settings = $this->get_settings_for_display(); | |
| 1253 | - | |
| 1254 | - if ( ! $settings['show_reviewer_name'] ) { | |
| 1255 | - return; | |
| 1256 | - } | |
| 1257 | - | |
| 1258 | - ?> | |
| 1259 | - <?php if ( $item['reviewer_name'] ) : ?> | |
| 1260 | - <<?php esc_html_e($settings['review_name_tag']); ?> class="ui-e-testimonial-name <?php esc_attr_e($settings['name_animations']);?>"> | |
| 1261 | - <span><?php echo wp_kses_post($item['reviewer_name']);?></span> | |
| 1262 | - </<?php esc_html_e($settings['review_name_tag']); ?>> | |
| 1263 | - <?php endif; ?> | |
| 1264 | - <?php | |
| 1265 | - } | |
| 1266 | - function render_reviewer_job_title($item) | |
| 1267 | - { | |
| 1268 | - $settings = $this->get_settings_for_display(); | |
| 1269 | - | |
| 1270 | - if ( ! $settings['show_reviewer_job_title'] ) { | |
| 1271 | - return; | |
| 1272 | - } | |
| 1273 | - | |
| 1274 | - ?> | |
| 1275 | - <?php if ( $item['reviewer_job_title'] ) : ?> | |
| 1276 | - <div class="ui-e-testimonial-job-title <?php esc_attr_e($settings['job_animations']);?>"> | |
| 1277 | - <span><?php esc_html_e($item['reviewer_job_title']); ?></span> | |
| 1278 | - </div> | |
| 1279 | - <?php endif; ?> | |
| 1280 | - <?php | |
| 1281 | - } | |
| 1282 | - function render_review_text($item) | |
| 1283 | - { | |
| 1284 | - $settings = $this->get_settings_for_display(); | |
| 1285 | - | |
| 1286 | - if ( ! $settings['show_reviewer_text'] ) { | |
| 1287 | - return; | |
| 1288 | - } | |
| 1289 | - | |
| 1290 | - ?> | |
| 1291 | - <?php if ( $item['review_text'] ) : ?> | |
| 1292 | - <div class="ui-e-testimonial-text <?php esc_attr_e($settings['text_animations']);?>"> | |
| 1293 | - <?php echo wp_kses_post( $item['review_text'] ); ?> | |
| 1294 | - </div> | |
| 1295 | - <?php endif; ?> | |
| 1296 | - <?php | |
| 1297 | - } | |
| 1298 | - function render_review_rating($item) | |
| 1299 | - { | |
| 1300 | - | |
| 1301 | - $settings = $this->get_settings_for_display(); | |
| 1302 | - | |
| 1303 | - $ID = $item['_id']; | |
| 1304 | - if ( !$settings['show_reviewer_rating'] ) { | |
| 1305 | - return; | |
| 1306 | - } | |
| 1307 | - | |
| 1308 | - $rating_value = $item['rating_number']['size']; // get rating value | |
| 1309 | - | |
| 1310 | - if ($settings['rating_type'] == 'star') { | |
| 1311 | - | |
| 1312 | - ?> | |
| 1313 | - <div class="ui-e-testimonial-rating <?php esc_attr_e($settings['rating_animations']);?>"> | |
| 1314 | - <?php | |
| 1315 | - | |
| 1316 | - $rating_scale = 5; | |
| 1317 | - | |
| 1318 | - if ( '' === $rating_value ) { | |
| 1319 | - $rating_value = $rating_scale; | |
| 1320 | - } | |
| 1321 | - | |
| 1322 | - $rating_value = floatval( $rating_value ); | |
| 1323 | - $rating_value = round( $rating_value, 2 ); | |
| 1324 | - | |
| 1325 | - for ( $index = 1; $index <= $rating_scale; $index++ ) { | |
| 1326 | - | |
| 1327 | - // SVG Method (uses font-awesome library for it's half-star icon, and can prints full and half-star) | |
| 1328 | - if (Plugin::$instance->experiments->is_feature_active('e_font_icon_svg')){ | |
| 1329 | - ?> | |
| 1330 | - <div class="ui-e-icon"> | |
| 1331 | - <?php | |
| 1332 | - if ( $rating_value >= $index ) { | |
| 1333 | - echo Icons_Manager::try_get_icon_html( ['value' => 'fas fa-star', 'library' => 'fa-solid'], [ 'aria-hidden' => 'true' ] ); | |
| 1334 | - } elseif ( intval( ceil( $rating_value ) ) === $index ) { | |
| 1335 | - echo Icons_Manager::try_get_icon_html( ['value' => 'fas fa-star-half', 'library' => 'fa-solid'], ['aria-hidden' => 'true'] ); | |
| 1336 | - } | |
| 1337 | - ?> | |
| 1338 | - </div> | |
| 1339 | - <?php | |
| 1340 | - // Font Icon Method (uses elementor library and can print decimal specific stars) | |
| 1341 | - } else { | |
| 1342 | - | |
| 1343 | - if ( $rating_value >= $index ) { | |
| 1344 | - $width = '100%'; // Full star if rate superior to current loop | |
| 1345 | - } elseif ( intval( ceil( $rating_value ) ) === $index ) { | |
| 1346 | - $width = ( $rating_value - ( $index - 1 ) ) * 100 . '%'; // Semi-star, calculating the width based on the decimal value | |
| 1347 | - } else { | |
| 1348 | - $width = '0%'; // No star if rate inferior to current loop | |
| 1349 | - } | |
| 1350 | - | |
| 1351 | - // Creates the atts | |
| 1352 | - $this->add_render_attribute( "icon_marked_$ID" . "_$index", [ | |
| 1353 | - 'class' => 'ui-e-marked', | |
| 1354 | - ] ); | |
| 1355 | - if ( '100%' !== $width ) { | |
| 1356 | - $this->add_render_attribute( "icon_marked_$ID" . "_$index", [ | |
| 1357 | - 'style' => '--ui-e-rate-width: ' . $width . ';', | |
| 1358 | - ] ); | |
| 1359 | - } | |
| 1360 | - | |
| 1361 | - ?> | |
| 1362 | - <div class="ui-e-icon"> | |
| 1363 | - <div <?php $this->print_render_attribute_string( "icon_marked_$ID" . "_$index",); ?>> | |
| 1364 | - <?php echo Icons_Manager::try_get_icon_html( ['value' => 'eicon-star','library' => 'eicons'], [ 'aria-hidden' => 'true' ] );?> | |
| 1365 | - </div> | |
| 1366 | - <div class="ui-e-unmarked"> | |
| 1367 | - <?php echo Icons_Manager::try_get_icon_html( ['value' => 'eicon-star','library' => 'eicons'], [ 'aria-hidden' => 'true' ] );?> | |
| 1368 | - </div> | |
| 1369 | - </div> | |
| 1370 | - <?php | |
| 1371 | - } | |
| 1372 | - } | |
| 1373 | - ?> | |
| 1374 | - </div> | |
| 1375 | - <?php | |
| 1376 | - | |
| 1377 | - } else { // number type rating | |
| 1378 | - ?> | |
| 1379 | - <div class="ui-e-testimonial-rating number"> | |
| 1380 | - <span><?php esc_html_e($rating_value);?></span> | |
| 1381 | - </div> | |
| 1382 | - <?php | |
| 1383 | - } | |
| 1384 | - } | |
| 1385 | - function render_review_divider() | |
| 1386 | - { | |
| 1387 | - $settings = $this->get_settings_for_display(); | |
| 1388 | - | |
| 1389 | - if ( !$settings['show_reviewer_divider'] ) { | |
| 1390 | - return; | |
| 1391 | - } | |
| 1392 | - | |
| 1393 | - ?> | |
| 1394 | - <span class="ui-e-testimonial-divider"></span> | |
| 1395 | - <?php | |
| 1396 | - } | |
| 1397 | - function TRAIT_render_review_item($item, $layout) | |
| 1398 | - { | |
| 1399 | - $settings = $this->get_settings_for_display(); | |
| 1400 | - | |
| 1401 | - // Atts used by some layouts | |
| 1402 | - $atts = [ | |
| 1403 | - 'inline' => $settings['image_inline'] == 'yes' ? true : false, | |
| 1404 | - ]; | |
| 1405 | - | |
| 1406 | - // Get entrance and item hover animation classes | |
| 1407 | - $entrance = (isset($settings['animate_items']) && $settings['animate_items'] == 'ui-e-grid-animate') ? 'elementor-invisible' : ''; | |
| 1408 | - $hover = isset($settings['item_hover_animation']) ? $settings['item_hover_animation'] : null; | |
| 1409 | - $animations = sprintf('%s %s', $entrance, $hover); | |
| 1410 | - | |
| 1411 | - // Get all elements animation control options (triggered by .ui-e-animations-wrp:hover) | |
| 1412 | - $animation_options = [ | |
| 1413 | - $settings['image_animations'], | |
| 1414 | - $settings['avatar_animations'], | |
| 1415 | - $settings['text_animations'], | |
| 1416 | - $settings['name_animations'], | |
| 1417 | - $settings['job_animations'], | |
| 1418 | - $settings['rating_animations'] | |
| 1419 | - ]; | |
| 1420 | - // get item animation only if is not slider, | |
| 1421 | - if (!str_contains($this->get_name(), 'slider')) { | |
| 1422 | - $animation_options[] = $settings['item_hover_animation']; | |
| 1423 | - } | |
| 1424 | - // check if any of the animation are set | |
| 1425 | - $has_animation = array_filter($animation_options, function($value) { | |
| 1426 | - return $value !== ''; | |
| 1427 | - }); | |
| 1428 | - // and also check if entrance is set | |
| 1429 | - $has_animation = $entrance !== '' ? true : $has_animation; | |
| 1430 | - | |
| 1431 | - ?> | |
| 1432 | - | |
| 1433 | - <div class="ui-e-wrp swiper-slide"> | |
| 1434 | - <?php if (!empty($has_animation)) : ?> | |
| 1435 | - <div class="ui-e-animations-wrp <?php echo esc_attr($animations);?>"> | |
| 1436 | - <?php endif; ?> | |
| 1437 | - <div class="ui-e-item"> | |
| 1438 | - <?php | |
| 1439 | - switch($layout){ | |
| 1440 | - case 'layout_2' : | |
| 1441 | - $this->render_layout_2($item, $atts); | |
| 1442 | - break; | |
| 1443 | - case 'layout_3' : | |
| 1444 | - $this->render_layout_3($item, $atts); | |
| 1445 | - break; | |
| 1446 | - case 'layout_4' : | |
| 1447 | - $this->render_layout_4($item); | |
| 1448 | - break; | |
| 1449 | - case 'layout_5' : | |
| 1450 | - $this->render_layout_5($item); | |
| 1451 | - break; | |
| 1452 | - case 'layout_6' : | |
| 1453 | - $this->render_layout_6($item); | |
| 1454 | - break; | |
| 1455 | - default: | |
| 1456 | - $this->render_layout_1($item, $atts); | |
| 1457 | - break; | |
| 1458 | - } | |
| 1459 | - ?> | |
| 1460 | - </div> | |
| 1461 | - <?php if (!empty($has_animation)) : ?> | |
| 1462 | - </div> | |
| 1463 | - <?php endif; ?> | |
| 1464 | - </div> | |
| 1465 | - <?php | |
| 1466 | - } | |
| 1467 | - | |
| 1468 | - // Layouts | |
| 1469 | - function render_layout_1($item, $atts) | |
| 1470 | - { | |
| 1471 | - | |
| 1472 | - $this->render_reviewer_secondary_image($item); | |
| 1473 | - ?> | |
| 1474 | - <div class="ui-e-content"> | |
| 1475 | - | |
| 1476 | - <?php $this->render_review_text($item); ?> | |
| 1477 | - | |
| 1478 | - <?php if ($atts['inline']) : ?> | |
| 1479 | - | |
| 1480 | - <div class="ui-e-testimonial-flex"> | |
| 1481 | - <?php $this->render_reviewer_avatar($item); ?> | |
| 1482 | - <div class="ui-e-inner-content"> | |
| 1483 | - <?php | |
| 1484 | - $this->render_reviewer_name($item); | |
| 1485 | - $this->render_reviewer_job_title($item); | |
| 1486 | - $this->render_review_rating($item); | |
| 1487 | - ?> | |
| 1488 | - </div> | |
| 1489 | - </div> | |
| 1490 | - | |
| 1491 | - <?php else : | |
| 1492 | - $this->render_reviewer_avatar($item); | |
| 1493 | - $this->render_reviewer_name($item); | |
| 1494 | - $this->render_reviewer_job_title($item); | |
| 1495 | - $this->render_review_rating($item); | |
| 1496 | - endif; ?> | |
| 1497 | - | |
| 1498 | - </div> | |
| 1499 | - <?php | |
| 1500 | - } | |
| 1501 | - function render_layout_2($item, $atts) | |
| 1502 | - { | |
| 1503 | - ?> | |
| 1504 | - <div class="ui-e-content"> | |
| 1505 | - | |
| 1506 | - <?php if ($atts['inline']) : ?> | |
| 1507 | - <div class="ui-e-testimonial-flex"> | |
| 1508 | - <?php $this->render_reviewer_avatar($item); ?> | |
| 1509 | - <div class="ui-e-inner-content"> | |
| 1510 | - <?php | |
| 1511 | - $this->render_reviewer_name($item); | |
| 1512 | - $this->render_reviewer_job_title($item); | |
| 1513 | - $this->render_review_rating($item); | |
| 1514 | - ?> | |
| 1515 | - </div> | |
| 1516 | - </div> | |
| 1517 | - | |
| 1518 | - <?php else : | |
| 1519 | - $this->render_reviewer_avatar($item); | |
| 1520 | - $this->render_reviewer_name($item); | |
| 1521 | - $this->render_reviewer_job_title($item); | |
| 1522 | - $this->render_review_rating($item); | |
| 1523 | - endif; ?> | |
| 1524 | - | |
| 1525 | - <?php $this->render_review_text($item); ?> | |
| 1526 | - </div> | |
| 1527 | - | |
| 1528 | - <?php | |
| 1529 | - $this->render_reviewer_secondary_image($item); | |
| 1530 | - } | |
| 1531 | - function render_layout_3($item, $atts) | |
| 1532 | - { | |
| 1533 | - $this->render_reviewer_secondary_image($item); | |
| 1534 | - ?> | |
| 1535 | - <div class="ui-e-content"> | |
| 1536 | - | |
| 1537 | - <?php | |
| 1538 | - $this->render_review_rating($item); | |
| 1539 | - $this->render_review_text($item); | |
| 1540 | - $this->render_review_divider(); | |
| 1541 | - ?> | |
| 1542 | - | |
| 1543 | - <?php if ($atts['inline']) :?> | |
| 1544 | - | |
| 1545 | - <div class="ui-e-testimonial-flex"> | |
| 1546 | - <?php $this->render_reviewer_avatar($item); ?> | |
| 1547 | - <div class="ui-e-inner-content"> | |
| 1548 | - <?php $this->render_reviewer_name($item); ?> | |
| 1549 | - <?php $this->render_reviewer_job_title($item); ?> | |
| 1550 | - </div> | |
| 1551 | - </div> | |
| 1552 | - | |
| 1553 | - <?php else : | |
| 1554 | - $this->render_reviewer_avatar($item); | |
| 1555 | - $this->render_reviewer_name($item); | |
| 1556 | - $this->render_reviewer_job_title($item); | |
| 1557 | - endif; ?> | |
| 1558 | - </div> | |
| 1559 | - <?php | |
| 1560 | - } | |
| 1561 | - function render_layout_4($item) | |
| 1562 | - { | |
| 1563 | - ?> | |
| 1564 | - <div class="ui-e-testimonial-flex"> | |
| 1565 | - <?php $this->render_reviewer_avatar($item); ?> | |
| 1566 | - <?php $this->render_reviewer_secondary_image($item); ?> | |
| 1567 | - </div> | |
| 1568 | - | |
| 1569 | - <div class="ui-e-content"> | |
| 1570 | - <?php | |
| 1571 | - $this->render_review_text($item); | |
| 1572 | - $this->render_reviewer_name($item); | |
| 1573 | - $this->render_reviewer_job_title($item); | |
| 1574 | - $this->render_review_rating($item); | |
| 1575 | - ?> | |
| 1576 | - </div> | |
| 1577 | - <?php | |
| 1578 | - } | |
| 1579 | - function render_layout_5($item) | |
| 1580 | - { | |
| 1581 | - ?> | |
| 1582 | - <div class="ui-e-testimonial-flex"> | |
| 1583 | - <div class="ui-e-content"> | |
| 1584 | - | |
| 1585 | - <?php | |
| 1586 | - $this->render_reviewer_secondary_image($item); | |
| 1587 | - $this->render_review_text($item); | |
| 1588 | - $this->render_review_rating($item); | |
| 1589 | - $this->render_reviewer_name($item); | |
| 1590 | - $this->render_reviewer_job_title($item); | |
| 1591 | - ?> | |
| 1592 | - </div> | |
| 1593 | - <?php $this->render_reviewer_avatar($item); ?> | |
| 1594 | - </div> | |
| 1595 | - <?php | |
| 1596 | - } | |
| 1597 | - function render_layout_6($item) | |
| 1598 | - { | |
| 1599 | - ?> | |
| 1600 | - <div class="ui-e-testimonial-flex"> | |
| 1601 | - | |
| 1602 | - <?php $this->render_reviewer_avatar($item); ?> | |
| 1603 | - | |
| 1604 | - <div class="ui-e-content"> | |
| 1605 | - <?php | |
| 1606 | - $this->render_reviewer_name($item); | |
| 1607 | - $this->render_reviewer_job_title($item); | |
| 1608 | - $this->render_review_rating($item); | |
| 1609 | - $this->render_review_text($item); | |
| 1610 | - $this->render_reviewer_secondary_image($item); | |
| 1611 | - ?> | |
| 1612 | - </div> | |
| 1613 | - </div> | |
| 1614 | - <?php | |
| 1615 | - } | |
| 1616 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UiCoreElements\Utils; | |
| 4 | + | |
| 5 | +use Elementor\Controls_Manager; | |
| 6 | +use Elementor\Plugin; | |
| 7 | +use Elementor\Utils; | |
| 8 | +use Elementor\Repeater; | |
| 9 | +use Elementor\Icons_Manager; | |
| 10 | +use Elementor\Group_Control_Image_Size; | |
| 11 | +use Elementor\Group_Control_Box_Shadow; | |
| 12 | +use Elementor\Group_Control_Border; | |
| 13 | +use Elementor\Group_Control_Typography; | |
| 14 | +use Elementor\Group_Control_Text_Shadow; | |
| 15 | +use Elementor\Core\Kits\Documents\Tabs\Global_Colors; | |
| 16 | +use UiCoreElements\Helper; | |
| 17 | + | |
| 18 | + | |
| 19 | +defined('ABSPATH') || exit(); | |
| 20 | + | |
| 21 | +trait Testimonial_Trait | |
| 22 | +{ | |
| 23 | + | |
| 24 | + // Content Controls Functions | |
| 25 | + function TRAIT_register_testimonial_repeater_controls($logo) | |
| 26 | + { | |
| 27 | + $this->start_controls_section( | |
| 28 | + 'section_reviewer_content', | |
| 29 | + [ | |
| 30 | + /* translators: %s: Control title */ | |
| 31 | + 'label' => esc_html(sprintf('%s', $logo), 'uicore-elements'), | |
| 32 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 33 | + ] | |
| 34 | + ); | |
| 35 | + | |
| 36 | + $repeater = new Repeater(); | |
| 37 | + | |
| 38 | + $repeater->add_control( | |
| 39 | + 'avatar', | |
| 40 | + [ | |
| 41 | + 'label' => __('Avatar', 'uicore-elements'), | |
| 42 | + 'type' => Controls_Manager::MEDIA, | |
| 43 | + 'render_type' => 'template', | |
| 44 | + 'dynamic' => [ | |
| 45 | + 'active' => true, | |
| 46 | + ], | |
| 47 | + 'default' => [ | |
| 48 | + 'url' => Utils::get_placeholder_image_src(), | |
| 49 | + ], | |
| 50 | + ] | |
| 51 | + ); | |
| 52 | + $repeater->add_control( | |
| 53 | + 'reviewer_name', | |
| 54 | + [ | |
| 55 | + 'label' => __('Name', 'uicore-elements'), | |
| 56 | + 'type' => Controls_Manager::TEXT, | |
| 57 | + 'dynamic' => [ | |
| 58 | + 'active' => true, | |
| 59 | + ], | |
| 60 | + 'default' => __('Adam Smith', 'uicore-elements'), | |
| 61 | + 'placeholder' => __('Enter reviewer name', 'uicore-elements'), | |
| 62 | + 'label_block' => true, | |
| 63 | + ] | |
| 64 | + ); | |
| 65 | + $repeater->add_control( | |
| 66 | + 'reviewer_job_title', | |
| 67 | + [ | |
| 68 | + 'label' => __('Job Title', 'uicore-elements'), | |
| 69 | + 'type' => Controls_Manager::TEXT, | |
| 70 | + 'dynamic' => [ | |
| 71 | + 'active' => true, | |
| 72 | + ], | |
| 73 | + 'default' => __('SEO Expert', 'uicore-elements'), | |
| 74 | + 'placeholder' => __('Enter reviewer job title', 'uicore-elements'), | |
| 75 | + 'label_block' => true, | |
| 76 | + ] | |
| 77 | + ); | |
| 78 | + $repeater->add_control( | |
| 79 | + 'rating_number', | |
| 80 | + [ | |
| 81 | + 'label' => __('Rating', 'uicore-elements'), | |
| 82 | + 'type' => Controls_Manager::SLIDER, | |
| 83 | + 'size_units' => ['px'], | |
| 84 | + 'default' => [ | |
| 85 | + 'size' => 4.5, | |
| 86 | + ], | |
| 87 | + 'range' => [ | |
| 88 | + 'px' => [ | |
| 89 | + 'min' => 0, | |
| 90 | + 'max' => 5, | |
| 91 | + 'step' => .5, | |
| 92 | + ], | |
| 93 | + ], | |
| 94 | + 'dynamic' => [ | |
| 95 | + 'active' => true, | |
| 96 | + ], | |
| 97 | + ] | |
| 98 | + ); | |
| 99 | + $repeater->add_control( | |
| 100 | + 'review_text', | |
| 101 | + [ | |
| 102 | + 'label' => __('Review Text', 'uicore-elements'), | |
| 103 | + 'type' => Controls_Manager::WYSIWYG, | |
| 104 | + 'dynamic' => [ | |
| 105 | + 'active' => true, | |
| 106 | + ], | |
| 107 | + 'default' => __('Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'uicore-elements'), | |
| 108 | + 'placeholder' => __('Enter review text', 'uicore-elements'), | |
| 109 | + ] | |
| 110 | + ); | |
| 111 | + $repeater->add_control( | |
| 112 | + 'image', | |
| 113 | + [ | |
| 114 | + 'label' => __('Secondary Image', 'uicore-elements'), | |
| 115 | + 'type' => Controls_Manager::MEDIA, | |
| 116 | + 'render_type' => 'template', | |
| 117 | + 'dynamic' => [ | |
| 118 | + 'active' => true, | |
| 119 | + ], | |
| 120 | + 'default' => [ | |
| 121 | + 'url' => Utils::get_placeholder_image_src(), | |
| 122 | + ], | |
| 123 | + ] | |
| 124 | + ); | |
| 125 | + $this->add_control( | |
| 126 | + 'review_items', | |
| 127 | + [ | |
| 128 | + 'show_label' => false, | |
| 129 | + 'type' => Controls_Manager::REPEATER, | |
| 130 | + 'fields' => $repeater->get_controls(), | |
| 131 | + 'title_field' => '{{{ reviewer_name }}}', | |
| 132 | + 'default' => [ | |
| 133 | + [ | |
| 134 | + 'reviewer_name' => __('Adam', 'uicore-elements'), | |
| 135 | + 'reviewer_job_title' => __('SEO Expert', 'uicore-elements'), | |
| 136 | + ], | |
| 137 | + [ | |
| 138 | + 'reviewer_name' => __('Karl', 'uicore-elements'), | |
| 139 | + 'reviewer_job_title' => __('Designer', 'uicore-elements'), | |
| 140 | + ], | |
| 141 | + [ | |
| 142 | + 'reviewer_name' => __('Maria', 'uicore-elements'), | |
| 143 | + 'reviewer_job_title' => __('Developer', 'uicore-elements'), | |
| 144 | + ], | |
| 145 | + [ | |
| 146 | + 'reviewer_name' => __('Michael', 'uicore-elements'), | |
| 147 | + 'reviewer_job_title' => __('Manager', 'uicore-elements'), | |
| 148 | + ], | |
| 149 | + [ | |
| 150 | + 'reviewer_name' => __('Lena', 'uicore-elements'), | |
| 151 | + 'reviewer_job_title' => __('CEO', 'uicore-elements'), | |
| 152 | + ], | |
| 153 | + [ | |
| 154 | + 'reviewer_name' => __('Jennifer', 'uicore-elements'), | |
| 155 | + 'reviewer_job_title' => __('Consultant', 'uicore-elements'), | |
| 156 | + ], | |
| 157 | + ] | |
| 158 | + ] | |
| 159 | + ); | |
| 160 | + | |
| 161 | + $this->end_controls_section(); | |
| 162 | + } | |
| 163 | + function TRAIT_register_testimonial_additional_controls() | |
| 164 | + { | |
| 165 | + $this->add_control( | |
| 166 | + 'show_reviewer_name', | |
| 167 | + [ | |
| 168 | + 'label' => __('Show Name', 'uicore-elements'), | |
| 169 | + 'type' => Controls_Manager::SWITCHER, | |
| 170 | + 'default' => 'yes', | |
| 171 | + 'separator' => 'before', | |
| 172 | + ] | |
| 173 | + ); | |
| 174 | + $this->add_control( | |
| 175 | + 'review_name_tag', | |
| 176 | + [ | |
| 177 | + 'label' => __('Name HTML Tag', 'uicore-elements'), | |
| 178 | + 'type' => Controls_Manager::SELECT, | |
| 179 | + 'default' => 'h4', | |
| 180 | + 'options' => Helper::get_title_tags(), | |
| 181 | + 'condition' => [ | |
| 182 | + 'show_reviewer_name' => 'yes', | |
| 183 | + ] | |
| 184 | + ] | |
| 185 | + ); | |
| 186 | + $this->add_control( | |
| 187 | + 'show_reviewer_job_title', | |
| 188 | + [ | |
| 189 | + 'label' => __('Show Job Title', 'uicore-elements'), | |
| 190 | + 'type' => Controls_Manager::SWITCHER, | |
| 191 | + 'default' => 'yes', | |
| 192 | + 'separator' => 'before', | |
| 193 | + ] | |
| 194 | + ); | |
| 195 | + $this->add_control( | |
| 196 | + 'show_reviewer_rating', | |
| 197 | + [ | |
| 198 | + 'label' => __('Show Rating', 'uicore-elements'), | |
| 199 | + 'type' => Controls_Manager::SWITCHER, | |
| 200 | + 'default' => 'yes', | |
| 201 | + 'separator' => 'before' | |
| 202 | + ] | |
| 203 | + ); | |
| 204 | + $this->add_control( | |
| 205 | + 'rating_type', | |
| 206 | + [ | |
| 207 | + 'label' => __('Rating Type', 'uicore-elements'), | |
| 208 | + 'type' => Controls_Manager::SELECT, | |
| 209 | + 'default' => 'star', | |
| 210 | + 'options' => [ | |
| 211 | + 'star' => __('Star', 'uicore-elements'), | |
| 212 | + 'number' => __('Number', 'uicore-elements'), | |
| 213 | + ], | |
| 214 | + 'condition' => [ | |
| 215 | + 'show_reviewer_rating' => 'yes' | |
| 216 | + ] | |
| 217 | + ] | |
| 218 | + ); | |
| 219 | + $this->add_control( | |
| 220 | + 'show_reviewer_text', | |
| 221 | + [ | |
| 222 | + 'label' => __('Show Review Text', 'uicore-elements'), | |
| 223 | + 'type' => Controls_Manager::SWITCHER, | |
| 224 | + 'default' => 'yes', | |
| 225 | + 'separator' => 'before', | |
| 226 | + ] | |
| 227 | + ); | |
| 228 | + $this->add_control( | |
| 229 | + 'show_reviewer_image', | |
| 230 | + [ | |
| 231 | + 'label' => __('Show Image', 'uicore-elements'), | |
| 232 | + 'type' => Controls_Manager::SWITCHER, | |
| 233 | + 'default' => 'yes', | |
| 234 | + 'separator' => 'before', | |
| 235 | + ] | |
| 236 | + ); | |
| 237 | + $this->add_group_control( | |
| 238 | + Group_Control_Image_Size::get_type(), | |
| 239 | + [ | |
| 240 | + 'name' => 'image_media_size', | |
| 241 | + 'default' => 'medium', | |
| 242 | + 'condition' => [ | |
| 243 | + 'show_reviewer_image' => 'yes' | |
| 244 | + ] | |
| 245 | + ] | |
| 246 | + ); | |
| 247 | + $this->add_control( | |
| 248 | + 'show_reviewer_avatar', | |
| 249 | + [ | |
| 250 | + 'label' => __('Show Avatar', 'uicore-elements'), | |
| 251 | + 'type' => Controls_Manager::SWITCHER, | |
| 252 | + 'default' => 'yes', | |
| 253 | + 'separator' => 'before', | |
| 254 | + ] | |
| 255 | + ); | |
| 256 | + $this->add_group_control( | |
| 257 | + Group_Control_Image_Size::get_type(), | |
| 258 | + [ | |
| 259 | + 'name' => 'avatar_media_size', | |
| 260 | + 'default' => 'medium', | |
| 261 | + 'condition' => [ | |
| 262 | + 'show_reviewer_avatar' => 'yes' | |
| 263 | + ] | |
| 264 | + ] | |
| 265 | + ); | |
| 266 | + $this->add_control( | |
| 267 | + 'image_inline', | |
| 268 | + [ | |
| 269 | + 'label' => esc_html__('Image Inline', 'uicore-elements'), | |
| 270 | + 'type' => Controls_Manager::SWITCHER, | |
| 271 | + 'condition' => [ | |
| 272 | + 'show_reviewer_avatar' => 'yes' | |
| 273 | + ], | |
| 274 | + 'prefix_class' => 'ui-e-img-inline-', | |
| 275 | + 'render_type' => 'template', | |
| 276 | + 'condition' => [ | |
| 277 | + 'layout' => ['layout_1', 'layout_2', 'layout_3'], | |
| 278 | + 'show_reviewer_avatar' => 'yes' | |
| 279 | + ] | |
| 280 | + ] | |
| 281 | + ); | |
| 282 | + $this->add_responsive_control( | |
| 283 | + 'v_alignment', | |
| 284 | + [ | |
| 285 | + 'label' => __('Image Alignment', 'uicore-elements'), | |
| 286 | + 'type' => Controls_Manager::CHOOSE, | |
| 287 | + 'default' => 'flex-start', | |
| 288 | + 'toggle' => false, | |
| 289 | + 'options' => [ | |
| 290 | + 'flex-start' => [ | |
| 291 | + 'title' => __('Top', 'uicore-elements'), | |
| 292 | + 'icon' => 'eicon-v-align-top', | |
| 293 | + ], | |
| 294 | + 'center' => [ | |
| 295 | + 'title' => __('Center', 'uicore-elements'), | |
| 296 | + 'icon' => 'eicon-v-align-middle', | |
| 297 | + ], | |
| 298 | + 'flex-end' => [ | |
| 299 | + 'title' => __('Bottom', 'uicore-elements'), | |
| 300 | + 'icon' => 'eicon-v-align-bottom', | |
| 301 | + ], | |
| 302 | + ], | |
| 303 | + 'selectors' => [ | |
| 304 | + '{{WRAPPER}} .ui-e-item' => '--ui-e-img-alignment: {{VALUE}};', | |
| 305 | + ], | |
| 306 | + 'condition' => [ | |
| 307 | + 'layout' => 'layout_6' | |
| 308 | + ], | |
| 309 | + ] | |
| 310 | + ); | |
| 311 | + $this->add_control( | |
| 312 | + 'show_reviewer_divider', | |
| 313 | + [ | |
| 314 | + 'label' => __('Show Divider', 'uicore-elements'), | |
| 315 | + 'type' => Controls_Manager::SWITCHER, | |
| 316 | + 'default' => 'yes', | |
| 317 | + 'separator' => 'before', | |
| 318 | + 'condition' => [ | |
| 319 | + 'layout' => 'layout_3' | |
| 320 | + ] | |
| 321 | + ] | |
| 322 | + ); | |
| 323 | + $this->add_responsive_control( | |
| 324 | + 'h_alignment', | |
| 325 | + [ | |
| 326 | + 'label' => __('Content Alignment', 'uicore-elements'), | |
| 327 | + 'type' => Controls_Manager::CHOOSE, | |
| 328 | + 'options' => [ | |
| 329 | + 'left' => [ | |
| 330 | + 'title' => __('Left', 'uicore-elements'), | |
| 331 | + 'icon' => 'eicon-text-align-left', | |
| 332 | + ], | |
| 333 | + 'center' => [ | |
| 334 | + 'title' => __('Center', 'uicore-elements'), | |
| 335 | + 'icon' => 'eicon-text-align-center', | |
| 336 | + ], | |
| 337 | + 'right' => [ | |
| 338 | + 'title' => __('Right', 'uicore-elements'), | |
| 339 | + 'icon' => 'eicon-text-align-right', | |
| 340 | + ], | |
| 341 | + 'justify' => [ | |
| 342 | + 'title' => __('Justified', 'uicore-elements'), | |
| 343 | + 'icon' => 'eicon-text-align-justify', | |
| 344 | + ], | |
| 345 | + ], | |
| 346 | + 'default' => is_rtl() ? 'right' : 'left', | |
| 347 | + 'prefix_class' => 'ui-e-h-align-', | |
| 348 | + 'selectors' => [ | |
| 349 | + '{{WRAPPER}} .ui-e-item' => 'text-align: {{VALUE}};', | |
| 350 | + ], | |
| 351 | + 'separator' => 'before' | |
| 352 | + ] | |
| 353 | + ); | |
| 354 | + $this->add_responsive_control( | |
| 355 | + 'content_v_alignment', | |
| 356 | + [ | |
| 357 | + 'label' => __('Vertical Alignment', 'uicore-elements'), | |
| 358 | + 'type' => Controls_Manager::CHOOSE, | |
| 359 | + 'default' => 'center', | |
| 360 | + 'options' => [ | |
| 361 | + 'start' => [ | |
| 362 | + 'title' => __('Top', 'uicore-elements'), | |
| 363 | + 'icon' => 'eicon-align-start-v', | |
| 364 | + ], | |
| 365 | + 'center' => [ | |
| 366 | + 'title' => __('Center', 'uicore-elements'), | |
| 367 | + 'icon' => 'eicon-align-center-v', | |
| 368 | + ], | |
| 369 | + 'space-between' => [ | |
| 370 | + 'title' => __('Space Between', 'uicore-elements'), | |
| 371 | + 'icon' => 'eicon-justify-space-between-v', | |
| 372 | + ], | |
| 373 | + 'end' => [ | |
| 374 | + 'title' => __('Bottom', 'uicore-elements'), | |
| 375 | + 'icon' => 'eicon-align-end-v', | |
| 376 | + ], | |
| 377 | + ], | |
| 378 | + 'prefix_class' => 'ui-e-v-align-', | |
| 379 | + 'selectors' => [ | |
| 380 | + '{{WRAPPER}} .ui-e-item' => '--ui-e-content-v-alignment: {{VALUE}};', | |
| 381 | + ] | |
| 382 | + ] | |
| 383 | + ); | |
| 384 | + } | |
| 385 | + | |
| 386 | + // Style Controls Functions} | |
| 387 | + function register_testimonial_image_controls() | |
| 388 | + { | |
| 389 | + $this->start_controls_section( | |
| 390 | + 'section_style_avatar', | |
| 391 | + [ | |
| 392 | + 'label' => __('Avatar', 'uicore-elements'), | |
| 393 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 394 | + 'condition' => [ | |
| 395 | + 'show_reviewer_avatar' => 'yes' | |
| 396 | + ] | |
| 397 | + ] | |
| 398 | + ); | |
| 399 | + | |
| 400 | + $this->add_group_control( | |
| 401 | + Group_Control_Border::get_type(), | |
| 402 | + [ | |
| 403 | + 'name' => 'avatar_border', | |
| 404 | + 'selector' => '{{WRAPPER}} .ui-e-testimonial-avatar img' | |
| 405 | + ] | |
| 406 | + ); | |
| 407 | + $this->add_control( | |
| 408 | + 'avatar_radius', | |
| 409 | + [ | |
| 410 | + 'label' => esc_html__('Border Radius', 'uicore-elements'), | |
| 411 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 412 | + 'size_units' => ['px', 'em', '%'], | |
| 413 | + 'selectors' => [ | |
| 414 | + '{{WRAPPER}} .ui-e-testimonial-avatar img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 415 | + ], | |
| 416 | + ] | |
| 417 | + ); | |
| 418 | + $this->add_responsive_control( | |
| 419 | + 'avatar_padding', | |
| 420 | + [ | |
| 421 | + 'label' => __('Padding', 'uicore-elements'), | |
| 422 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 423 | + 'size_units' => ['px', 'em', '%'], | |
| 424 | + 'selectors' => [ | |
| 425 | + '{{WRAPPER}} .ui-e-testimonial-avatar img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 426 | + ], | |
| 427 | + ] | |
| 428 | + ); | |
| 429 | + $this->add_responsive_control( | |
| 430 | + 'avatar_size', | |
| 431 | + [ | |
| 432 | + 'label' => __('Size', 'uicore-elements'), | |
| 433 | + 'type' => Controls_Manager::SLIDER, | |
| 434 | + 'size_units' => ['px', '%'], | |
| 435 | + 'default' => [ | |
| 436 | + 'size' => 120, | |
| 437 | + 'unit' => 'px' | |
| 438 | + ], | |
| 439 | + 'range' => [ | |
| 440 | + '%' => [ | |
| 441 | + 'min' => 1, | |
| 442 | + 'max' => 100, | |
| 443 | + ], | |
| 444 | + 'px' => [ | |
| 445 | + 'min' => 10, | |
| 446 | + 'max' => 500, | |
| 447 | + ] | |
| 448 | + ], | |
| 449 | + 'description' => __('Using `%` might make image height fits the available space, depending on layout and inline options, cutting the image. Using `px` althougt adjust the image.', 'uicore-elements'), | |
| 450 | + 'selectors' => [ | |
| 451 | + '{{WRAPPER}}' => '--ui-e-avatar-size: {{SIZE}}{{UNIT}};', | |
| 452 | + ], | |
| 453 | + 'render_type' => 'template', | |
| 454 | + 'condition' => [ | |
| 455 | + 'layout!' => 'layout_5', | |
| 456 | + ] | |
| 457 | + ] | |
| 458 | + ); | |
| 459 | + $this->add_responsive_control( | |
| 460 | + 'avatar_size_px', | |
| 461 | + [ | |
| 462 | + 'label' => __('Size', 'uicore-elements'), | |
| 463 | + 'type' => Controls_Manager::SLIDER, | |
| 464 | + 'default' => [ | |
| 465 | + 'size' => 80, | |
| 466 | + 'unit' => 'px' | |
| 467 | + ], | |
| 468 | + 'range' => [ | |
| 469 | + 'px' => [ | |
| 470 | + 'min' => 1, | |
| 471 | + 'max' => 250, | |
| 472 | + ], | |
| 473 | + ], | |
| 474 | + 'selectors' => [ | |
| 475 | + '{{WRAPPER}}' => '--ui-e-avatar-size: {{SIZE}}{{UNIT}};', | |
| 476 | + ], | |
| 477 | + 'condition' => [ | |
| 478 | + 'layout' => 'layout_5', | |
| 479 | + ] | |
| 480 | + ] | |
| 481 | + ); | |
| 482 | + $this->add_responsive_control( | |
| 483 | + 'avatar_spacing', | |
| 484 | + [ | |
| 485 | + 'label' => __('Spacing', 'uicore-elements'), | |
| 486 | + 'type' => Controls_Manager::SLIDER, | |
| 487 | + 'default' => [ | |
| 488 | + 'size' => 15, | |
| 489 | + ], | |
| 490 | + 'selectors' => [ | |
| 491 | + '{{WRAPPER}}' => '--ui-e-avatar-spacing: {{SIZE}}{{UNIT}}' | |
| 492 | + ], | |
| 493 | + ] | |
| 494 | + ); | |
| 495 | + $this->add_group_control( | |
| 496 | + Group_Control_Box_Shadow::get_type(), | |
| 497 | + [ | |
| 498 | + 'name' => 'avatar_shadow', | |
| 499 | + 'selector' => '{{WRAPPER}} .ui-e-testimonial-avatar img' | |
| 500 | + ] | |
| 501 | + ); | |
| 502 | + $this->add_control( | |
| 503 | + 'avatar_offset_toggle', | |
| 504 | + [ | |
| 505 | + 'label' => __('Offset', 'uicore-elements'), | |
| 506 | + 'type' => Controls_Manager::POPOVER_TOGGLE, | |
| 507 | + 'label_off' => __('None', 'uicore-elements'), | |
| 508 | + 'label_on' => __('Custom', 'uicore-elements'), | |
| 509 | + 'return_value' => 'yes', | |
| 510 | + ] | |
| 511 | + ); | |
| 512 | + $this->start_popover(); | |
| 513 | + | |
| 514 | + $this->add_responsive_control( | |
| 515 | + 'avatar_horizontal_offset', | |
| 516 | + [ | |
| 517 | + 'label' => __('Horizontal', 'uicore-elements'), | |
| 518 | + 'type' => Controls_Manager::SLIDER, | |
| 519 | + 'default' => [ | |
| 520 | + 'size' => 0, | |
| 521 | + ], | |
| 522 | + 'tablet_default' => [ | |
| 523 | + 'size' => 0, | |
| 524 | + ], | |
| 525 | + 'mobile_default' => [ | |
| 526 | + 'size' => 0, | |
| 527 | + ], | |
| 528 | + 'range' => [ | |
| 529 | + 'px' => [ | |
| 530 | + 'min' => -200, | |
| 531 | + 'max' => 200, | |
| 532 | + ], | |
| 533 | + ], | |
| 534 | + 'condition' => [ | |
| 535 | + 'avatar_offset_toggle' => 'yes' | |
| 536 | + ], | |
| 537 | + 'render_type' => 'ui', | |
| 538 | + 'selectors' => [ | |
| 539 | + '{{WRAPPER}}' => '--ui-e-avatar-h-offset: {{SIZE}}px;' | |
| 540 | + ], | |
| 541 | + ] | |
| 542 | + ); | |
| 543 | + $this->add_responsive_control( | |
| 544 | + 'avatar_vertical_offset', | |
| 545 | + [ | |
| 546 | + 'label' => __('Vertical', 'uicore-elements'), | |
| 547 | + 'type' => Controls_Manager::SLIDER, | |
| 548 | + 'default' => [ | |
| 549 | + 'size' => 0, | |
| 550 | + ], | |
| 551 | + 'tablet_default' => [ | |
| 552 | + 'size' => 0, | |
| 553 | + ], | |
| 554 | + 'mobile_default' => [ | |
| 555 | + 'size' => 0, | |
| 556 | + ], | |
| 557 | + 'range' => [ | |
| 558 | + 'px' => [ | |
| 559 | + 'min' => -200, | |
| 560 | + 'max' => 200, | |
| 561 | + ], | |
| 562 | + ], | |
| 563 | + 'condition' => [ | |
| 564 | + 'avatar_offset_toggle' => 'yes' | |
| 565 | + ], | |
| 566 | + 'render_type' => 'ui', | |
| 567 | + 'selectors' => [ | |
| 568 | + '{{WRAPPER}}' => '--ui-e-avatar-v-offset: {{SIZE}}px;' | |
| 569 | + ], | |
| 570 | + ] | |
| 571 | + ); | |
| 572 | + $this->end_popover(); | |
| 573 | + | |
| 574 | + $this->end_controls_section(); | |
| 575 | + $this->start_controls_section( | |
| 576 | + 'section_style_image', | |
| 577 | + [ | |
| 578 | + 'label' => __('Secondary Image', 'uicore-elements'), | |
| 579 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 580 | + 'condition' => [ | |
| 581 | + 'show_reviewer_image' => 'yes' | |
| 582 | + ] | |
| 583 | + ] | |
| 584 | + ); | |
| 585 | + $this->add_responsive_control( | |
| 586 | + 'image_size', | |
| 587 | + [ | |
| 588 | + 'label' => __('Size', 'uicore-elements'), | |
| 589 | + 'type' => Controls_Manager::SLIDER, | |
| 590 | + 'default' => [ | |
| 591 | + 'size' => 40, | |
| 592 | + 'unit' => 'px' | |
| 593 | + ], | |
| 594 | + 'range' => [ | |
| 595 | + 'px' => [ | |
| 596 | + 'min' => 10, | |
| 597 | + 'max' => 500, | |
| 598 | + ], | |
| 599 | + ], | |
| 600 | + 'selectors' => [ | |
| 601 | + '{{WRAPPER}}' => '--ui-e-image-size: {{SIZE}}{{UNIT}};', | |
| 602 | + ], | |
| 603 | + ] | |
| 604 | + ); | |
| 605 | + $this->add_responsive_control( | |
| 606 | + 'image_spacing', | |
| 607 | + [ | |
| 608 | + 'label' => __('Spacing', 'uicore-elements'), | |
| 609 | + 'type' => Controls_Manager::SLIDER, | |
| 610 | + 'default' => [ | |
| 611 | + 'size' => 15, | |
| 612 | + ], | |
| 613 | + 'selectors' => [ | |
| 614 | + '{{WRAPPER}}' => '--ui-e-img-spacing: {{SIZE}}{{UNIT}}' | |
| 615 | + ], | |
| 616 | + 'condition' => [ | |
| 617 | + 'layout!' => ['layout_2', 'layout_4', 'layout_6'], | |
| 618 | + ] | |
| 619 | + ] | |
| 620 | + ); | |
| 621 | + $this->add_control( | |
| 622 | + 'image_offset_toggle', | |
| 623 | + [ | |
| 624 | + 'label' => __('Offset', 'uicore-elements'), | |
| 625 | + 'type' => Controls_Manager::POPOVER_TOGGLE, | |
| 626 | + 'label_off' => __('None', 'uicore-elements'), | |
| 627 | + 'label_on' => __('Custom', 'uicore-elements'), | |
| 628 | + 'return_value' => 'yes', | |
| 629 | + ] | |
| 630 | + ); | |
| 631 | + $this->start_popover(); | |
| 632 | + | |
| 633 | + $this->add_responsive_control( | |
| 634 | + 'image_horizontal_offset', | |
| 635 | + [ | |
| 636 | + 'label' => __('Horizontal', 'uicore-elements'), | |
| 637 | + 'type' => Controls_Manager::SLIDER, | |
| 638 | + 'default' => [ | |
| 639 | + 'size' => 0, | |
| 640 | + ], | |
| 641 | + 'tablet_default' => [ | |
| 642 | + 'size' => 0, | |
| 643 | + ], | |
| 644 | + 'mobile_default' => [ | |
| 645 | + 'size' => 0, | |
| 646 | + ], | |
| 647 | + 'range' => [ | |
| 648 | + 'px' => [ | |
| 649 | + 'min' => -200, | |
| 650 | + 'max' => 200, | |
| 651 | + ], | |
| 652 | + ], | |
| 653 | + 'condition' => [ | |
| 654 | + 'image_offset_toggle' => 'yes' | |
| 655 | + ], | |
| 656 | + 'render_type' => 'ui', | |
| 657 | + 'selectors' => [ | |
| 658 | + '{{WRAPPER}}' => '--ui-e-img-h-offset: {{SIZE}}px;' | |
| 659 | + ], | |
| 660 | + ] | |
| 661 | + ); | |
| 662 | + $this->add_responsive_control( | |
| 663 | + 'image_vertical_offset', | |
| 664 | + [ | |
| 665 | + 'label' => __('Vertical', 'uicore-elements'), | |
| 666 | + 'type' => Controls_Manager::SLIDER, | |
| 667 | + 'default' => [ | |
| 668 | + 'size' => 0, | |
| 669 | + ], | |
| 670 | + 'tablet_default' => [ | |
| 671 | + 'size' => 0, | |
| 672 | + ], | |
| 673 | + 'mobile_default' => [ | |
| 674 | + 'size' => 0, | |
| 675 | + ], | |
| 676 | + 'range' => [ | |
| 677 | + 'px' => [ | |
| 678 | + 'min' => -200, | |
| 679 | + 'max' => 200, | |
| 680 | + ], | |
| 681 | + ], | |
| 682 | + 'condition' => [ | |
| 683 | + 'image_offset_toggle' => 'yes' | |
| 684 | + ], | |
| 685 | + 'render_type' => 'ui', | |
| 686 | + 'selectors' => [ | |
| 687 | + '{{WRAPPER}}' => '--ui-e-img-v-offset: {{SIZE}}px;' | |
| 688 | + ], | |
| 689 | + ] | |
| 690 | + ); | |
| 691 | + $this->end_popover(); | |
| 692 | + $this->end_controls_section(); | |
| 693 | + } | |
| 694 | + function register_testimonial_name_controls() | |
| 695 | + { | |
| 696 | + $this->start_controls_section( | |
| 697 | + 'section_style_name', | |
| 698 | + [ | |
| 699 | + 'label' => __('Name', 'uicore-elements'), | |
| 700 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 701 | + 'condition' => [ | |
| 702 | + 'show_reviewer_name' => 'yes', | |
| 703 | + ] | |
| 704 | + ] | |
| 705 | + ); | |
| 706 | + | |
| 707 | + $this->add_control( | |
| 708 | + 'name_color', | |
| 709 | + [ | |
| 710 | + 'label' => __('Color', 'uicore-elements'), | |
| 711 | + 'type' => Controls_Manager::COLOR, | |
| 712 | + 'selectors' => [ | |
| 713 | + '{{WRAPPER}} .ui-e-testimonial-name' => 'color: {{VALUE}};', | |
| 714 | + ], | |
| 715 | + ] | |
| 716 | + ); | |
| 717 | + $this->add_control( | |
| 718 | + 'name_hover_color', | |
| 719 | + [ | |
| 720 | + 'label' => __('Hover Color', 'uicore-elements'), | |
| 721 | + 'type' => Controls_Manager::COLOR, | |
| 722 | + 'selectors' => [ | |
| 723 | + '{{WRAPPER}} .ui-e-item:hover .ui-e-testimonial-name' => 'color: {{VALUE}};', | |
| 724 | + ], | |
| 725 | + ] | |
| 726 | + ); | |
| 727 | + $this->add_responsive_control( | |
| 728 | + 'name_bottom_space', | |
| 729 | + [ | |
| 730 | + 'label' => __('Spacing', 'uicore-elements'), | |
| 731 | + 'type' => Controls_Manager::SLIDER, | |
| 732 | + 'range' => [ | |
| 733 | + 'px' => [ | |
| 734 | + 'min' => 0, | |
| 735 | + 'max' => 100, | |
| 736 | + ], | |
| 737 | + ], | |
| 738 | + 'selectors' => [ | |
| 739 | + '{{WRAPPER}} .ui-e-testimonial-name' => 'padding-bottom: {{SIZE}}{{UNIT}};', | |
| 740 | + ], | |
| 741 | + ] | |
| 742 | + ); | |
| 743 | + $this->add_group_control( | |
| 744 | + Group_Control_Typography::get_type(), | |
| 745 | + [ | |
| 746 | + 'name' => 'name_typography', | |
| 747 | + 'selector' => '{{WRAPPER}} .ui-e-testimonial-name', | |
| 748 | + ] | |
| 749 | + ); | |
| 750 | + $this->add_group_control( | |
| 751 | + Group_Control_Text_Shadow::get_type(), | |
| 752 | + [ | |
| 753 | + 'name' => 'name_shadow', | |
| 754 | + 'label' => __('Text Shadow', 'uicore-elements'), | |
| 755 | + 'selector' => '{{WRAPPER}} .ui-e-testimonial-name', | |
| 756 | + ] | |
| 757 | + ); | |
| 758 | + | |
| 759 | + $this->end_controls_section(); | |
| 760 | + } | |
| 761 | + function register_testimonial_job_controls() | |
| 762 | + { | |
| 763 | + $this->start_controls_section( | |
| 764 | + 'section_style_job_title', | |
| 765 | + [ | |
| 766 | + 'label' => __('Job Title', 'uicore-elements'), | |
| 767 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 768 | + 'condition' => [ | |
| 769 | + 'show_reviewer_job_title' => 'yes', | |
| 770 | + ] | |
| 771 | + ] | |
| 772 | + ); | |
| 773 | + | |
| 774 | + $this->add_control( | |
| 775 | + 'job_title_color', | |
| 776 | + [ | |
| 777 | + 'label' => __('Color', 'uicore-elements'), | |
| 778 | + 'type' => Controls_Manager::COLOR, | |
| 779 | + 'selectors' => [ | |
| 780 | + '{{WRAPPER}} .ui-e-testimonial-job-title' => 'color: {{VALUE}};', | |
| 781 | + ], | |
| 782 | + ] | |
| 783 | + ); | |
| 784 | + $this->add_control( | |
| 785 | + 'job_title_hover_color', | |
| 786 | + [ | |
| 787 | + 'label' => __('Hover Color', 'uicore-elements'), | |
| 788 | + 'type' => Controls_Manager::COLOR, | |
| 789 | + 'selectors' => [ | |
| 790 | + '{{WRAPPER}} .ui-e-item:hover .ui-e-testimonial-job-title' => 'color: {{VALUE}};', | |
| 791 | + ], | |
| 792 | + ] | |
| 793 | + ); | |
| 794 | + $this->add_responsive_control( | |
| 795 | + 'job_title_bottom_space', | |
| 796 | + [ | |
| 797 | + 'label' => __('Spacing', 'uicore-elements'), | |
| 798 | + 'type' => Controls_Manager::SLIDER, | |
| 799 | + 'range' => [ | |
| 800 | + 'px' => [ | |
| 801 | + 'min' => 0, | |
| 802 | + 'max' => 100, | |
| 803 | + ], | |
| 804 | + ], | |
| 805 | + 'default' => [ | |
| 806 | + 'size' => 10, | |
| 807 | + 'unit' => 'px' | |
| 808 | + ], | |
| 809 | + 'selectors' => [ | |
| 810 | + '{{WRAPPER}} .ui-e-testimonial-job-title' => 'padding-bottom: {{SIZE}}{{UNIT}};', | |
| 811 | + ], | |
| 812 | + ] | |
| 813 | + ); | |
| 814 | + $this->add_group_control( | |
| 815 | + Group_Control_Typography::get_type(), | |
| 816 | + [ | |
| 817 | + 'name' => 'job_title_typography', | |
| 818 | + 'selector' => '{{WRAPPER}} .ui-e-testimonial-job-title', | |
| 819 | + ] | |
| 820 | + ); | |
| 821 | + | |
| 822 | + $this->end_controls_section(); | |
| 823 | + } | |
| 824 | + function register_testimonial_text_controls() | |
| 825 | + { | |
| 826 | + $this->start_controls_section( | |
| 827 | + 'section_style_text', | |
| 828 | + [ | |
| 829 | + 'label' => __('Text', 'uicore-elements'), | |
| 830 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 831 | + 'condition' => [ | |
| 832 | + 'show_reviewer_text' => 'yes', | |
| 833 | + ] | |
| 834 | + ] | |
| 835 | + ); | |
| 836 | + | |
| 837 | + $this->add_control( | |
| 838 | + 'text_color', | |
| 839 | + [ | |
| 840 | + 'label' => __('Color', 'uicore-elements'), | |
| 841 | + 'type' => Controls_Manager::COLOR, | |
| 842 | + 'selectors' => [ | |
| 843 | + '{{WRAPPER}} .ui-e-testimonial-text' => 'color: {{VALUE}};', | |
| 844 | + ], | |
| 845 | + ] | |
| 846 | + ); | |
| 847 | + $this->add_control( | |
| 848 | + 'text_hover_color', | |
| 849 | + [ | |
| 850 | + 'label' => __('Hover Color', 'uicore-elements'), | |
| 851 | + 'type' => Controls_Manager::COLOR, | |
| 852 | + 'selectors' => [ | |
| 853 | + '{{WRAPPER}} .ui-e-item:hover .ui-e-testimonial-text' => 'color: {{VALUE}};', | |
| 854 | + ], | |
| 855 | + ] | |
| 856 | + ); | |
| 857 | + $this->add_group_control( | |
| 858 | + Group_Control_Typography::get_type(), | |
| 859 | + [ | |
| 860 | + 'name' => 'text_typography', | |
| 861 | + 'selector' => '{{WRAPPER}} .ui-e-testimonial-text', | |
| 862 | + ] | |
| 863 | + ); | |
| 864 | + $this->add_responsive_control( | |
| 865 | + 'text_bottom_space', | |
| 866 | + [ | |
| 867 | + 'label' => __('Spacing', 'uicore-elements'), | |
| 868 | + 'type' => Controls_Manager::SLIDER, | |
| 869 | + 'range' => [ | |
| 870 | + 'px' => [ | |
| 871 | + 'min' => 0, | |
| 872 | + 'max' => 100, | |
| 873 | + ], | |
| 874 | + ], | |
| 875 | + 'default' => [ | |
| 876 | + 'size' => 15, | |
| 877 | + 'unit' => 'px' | |
| 878 | + ], | |
| 879 | + 'selectors' => [ | |
| 880 | + '{{WRAPPER}} .ui-e-testimonial-text' => 'padding-bottom: {{SIZE}}{{UNIT}};', | |
| 881 | + ], | |
| 882 | + ] | |
| 883 | + ); | |
| 884 | + | |
| 885 | + $this->end_controls_section(); | |
| 886 | + } | |
| 887 | + function register_testimonial_rating_controls() | |
| 888 | + { | |
| 889 | + $this->start_controls_section( | |
| 890 | + 'section_style_rating', | |
| 891 | + [ | |
| 892 | + 'label' => esc_html__('Rating', 'uicore-elements'), | |
| 893 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 894 | + 'condition' => [ | |
| 895 | + 'show_reviewer_rating' => 'yes', | |
| 896 | + ], | |
| 897 | + ] | |
| 898 | + ); | |
| 899 | + | |
| 900 | + // If SVG inline, we only need one color control because the semi-star bg color hack is not enabled with this experiment | |
| 901 | + if (Plugin::$instance->experiments->is_feature_active('e_font_icon_svg')) { | |
| 902 | + $this->add_control( | |
| 903 | + 'active_rating_color', | |
| 904 | + [ | |
| 905 | + 'label' => esc_html__('Color', 'uicore-elements'), | |
| 906 | + 'type' => Controls_Manager::COLOR, | |
| 907 | + 'default' => '#ffab1a', | |
| 908 | + 'selectors' => [ | |
| 909 | + '{{WRAPPER}} .ui-e-testimonial-rating svg' => 'fill: {{VALUE}};', | |
| 910 | + ], | |
| 911 | + 'condition' => [ | |
| 912 | + 'rating_type' => 'star', | |
| 913 | + ], | |
| 914 | + ] | |
| 915 | + ); | |
| 916 | + // Without the experiment, two colors are usefull because <i> elements can be cut and printed as decimal-stars | |
| 917 | + } else { | |
| 918 | + $this->add_control( | |
| 919 | + 'active_rating_color', | |
| 920 | + [ | |
| 921 | + 'label' => esc_html__('Active Color', 'uicore-elements'), | |
| 922 | + 'type' => Controls_Manager::COLOR, | |
| 923 | + 'default' => '#ffab1a', | |
| 924 | + 'selectors' => [ | |
| 925 | + '{{WRAPPER}} .ui-e-testimonial-rating .ui-e-marked i' => 'color: {{VALUE}};', | |
| 926 | + ], | |
| 927 | + 'condition' => [ | |
| 928 | + 'rating_type' => 'star', | |
| 929 | + ], | |
| 930 | + ] | |
| 931 | + ); | |
| 932 | + $this->add_control( | |
| 933 | + 'rating_color', | |
| 934 | + [ | |
| 935 | + 'label' => esc_html__('Color', 'uicore-elements'), | |
| 936 | + 'type' => Controls_Manager::COLOR, | |
| 937 | + 'default' => '#ccd6df', | |
| 938 | + 'selectors' => [ | |
| 939 | + '{{WRAPPER}} .ui-e-testimonial-rating .ui-e-unmarked i' => 'color: {{VALUE}};', | |
| 940 | + ], | |
| 941 | + 'condition' => [ | |
| 942 | + 'rating_type' => 'star', | |
| 943 | + ], | |
| 944 | + ] | |
| 945 | + ); | |
| 946 | + } | |
| 947 | + $this->add_control( | |
| 948 | + 'rating_number_color', | |
| 949 | + [ | |
| 950 | + 'label' => esc_html__('Color', 'uicore-elements'), | |
| 951 | + 'type' => Controls_Manager::COLOR, | |
| 952 | + 'selectors' => [ | |
| 953 | + '{{WRAPPER}} .ui-e-testimonial-rating' => 'color: {{VALUE}};', | |
| 954 | + ], | |
| 955 | + 'condition' => [ | |
| 956 | + 'rating_type' => 'number', | |
| 957 | + ], | |
| 958 | + ] | |
| 959 | + ); | |
| 960 | + $this->add_control( | |
| 961 | + 'rating_background', | |
| 962 | + [ | |
| 963 | + 'label' => __('Background Color', 'uicore-elements'), | |
| 964 | + 'type' => Controls_Manager::COLOR, | |
| 965 | + 'selectors' => [ | |
| 966 | + '{{WRAPPER}} .ui-e-testimonial-rating' => 'background-color: {{VALUE}};', | |
| 967 | + ], | |
| 968 | + 'condition' => [ | |
| 969 | + 'rating_type' => 'star', | |
| 970 | + ], | |
| 971 | + ] | |
| 972 | + ); | |
| 973 | + $this->add_control( | |
| 974 | + 'rating_number_background', | |
| 975 | + [ | |
| 976 | + 'label' => __('Background Color', 'uicore-elements'), | |
| 977 | + 'type' => Controls_Manager::COLOR, | |
| 978 | + 'selectors' => [ | |
| 979 | + '{{WRAPPER}} .ui-e-testimonial-rating' => 'background-color: {{VALUE}};', | |
| 980 | + ], | |
| 981 | + 'default' => 'var(--e-global-color-uicore_primary)', | |
| 982 | + | |
| 983 | + 'condition' => [ | |
| 984 | + 'rating_type' => 'number', | |
| 985 | + ], | |
| 986 | + ] | |
| 987 | + ); | |
| 988 | + | |
| 989 | + $this->add_group_control( | |
| 990 | + Group_Control_Border::get_type(), | |
| 991 | + [ | |
| 992 | + 'name' => 'rating_border', | |
| 993 | + 'selector' => '{{WRAPPER}} .ui-e-testimonial-rating', | |
| 994 | + ] | |
| 995 | + ); | |
| 996 | + $this->add_control( | |
| 997 | + 'rating_border_radius', | |
| 998 | + [ | |
| 999 | + 'label' => __('Border Radius', 'uicore-elements'), | |
| 1000 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1001 | + 'size_units' => ['px', 'em', '%'], | |
| 1002 | + 'selectors' => [ | |
| 1003 | + '{{WRAPPER}} .ui-e-testimonial-rating' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1004 | + ], | |
| 1005 | + ] | |
| 1006 | + ); | |
| 1007 | + $this->add_control( | |
| 1008 | + 'rating_padding', | |
| 1009 | + [ | |
| 1010 | + 'label' => esc_html__('Padding', 'uicore-elements'), | |
| 1011 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1012 | + 'size_units' => ['px', 'em', '%'], | |
| 1013 | + 'selectors' => [ | |
| 1014 | + '{{WRAPPER}} .ui-e-testimonial-rating' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1015 | + ], | |
| 1016 | + ] | |
| 1017 | + ); | |
| 1018 | + $this->add_control( | |
| 1019 | + 'rating_margin', | |
| 1020 | + [ | |
| 1021 | + 'label' => esc_html__('Margin', 'uicore-elements'), | |
| 1022 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1023 | + 'size_units' => ['px', '%'], | |
| 1024 | + 'selectors' => [ | |
| 1025 | + '{{WRAPPER}} .ui-e-testimonial-rating' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1026 | + ], | |
| 1027 | + ] | |
| 1028 | + ); | |
| 1029 | + $this->add_control( | |
| 1030 | + 'rating_size', | |
| 1031 | + [ | |
| 1032 | + 'label' => esc_html__('Size', 'uicore-elements'), | |
| 1033 | + 'type' => Controls_Manager::SLIDER, | |
| 1034 | + 'default' => [ | |
| 1035 | + 'size' => 14, | |
| 1036 | + 'unit' => 'px' | |
| 1037 | + ], | |
| 1038 | + 'selectors' => [ | |
| 1039 | + '{{WRAPPER}} .ui-e-testimonial-rating' => 'font-size: {{SIZE}}{{UNIT}};', | |
| 1040 | + '{{WRAPPER}} .ui-e-testimonial-rating svg' => 'width: {{SIZE}}{{UNIT}};', | |
| 1041 | + ], | |
| 1042 | + ] | |
| 1043 | + ); | |
| 1044 | + $this->add_control( | |
| 1045 | + 'rating_space_between', | |
| 1046 | + [ | |
| 1047 | + 'label' => esc_html__('Space Between', 'uicore-elements'), | |
| 1048 | + 'type' => Controls_Manager::SLIDER, | |
| 1049 | + 'range' => [ | |
| 1050 | + 'px' => [ | |
| 1051 | + 'min' => 0, | |
| 1052 | + 'max' => 10, | |
| 1053 | + ], | |
| 1054 | + ], | |
| 1055 | + 'selectors' => [ | |
| 1056 | + '{{WRAPPER}} .ui-e-testimonial-rating .ui-e-icon + .ui-e-icon' => 'margin-left: {{SIZE}}{{UNIT}};', // star type | |
| 1057 | + '{{WRAPPER}} .ui-e-testimonial-rating span' => 'margin-right: {{SIZE}}{{UNIT}};', // number type | |
| 1058 | + ], | |
| 1059 | + 'condition' => [ | |
| 1060 | + 'rating_type' => 'star', | |
| 1061 | + ], | |
| 1062 | + ] | |
| 1063 | + ); | |
| 1064 | + | |
| 1065 | + $this->end_controls_section(); | |
| 1066 | + } | |
| 1067 | + function register_testimonial_divider_controls() | |
| 1068 | + { | |
| 1069 | + $this->start_controls_section( | |
| 1070 | + 'section_style_divider', | |
| 1071 | + [ | |
| 1072 | + 'label' => __('Divider', 'uicore-elements'), | |
| 1073 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 1074 | + 'condition' => [ | |
| 1075 | + 'layout' => 'layout_3', | |
| 1076 | + 'show_reviewer_divider' => 'yes' | |
| 1077 | + ] | |
| 1078 | + ] | |
| 1079 | + ); | |
| 1080 | + | |
| 1081 | + $this->add_control( | |
| 1082 | + 'divider_color', | |
| 1083 | + [ | |
| 1084 | + 'label' => __('Color', 'uicore-elements'), | |
| 1085 | + 'type' => Controls_Manager::COLOR, | |
| 1086 | + 'selectors' => [ | |
| 1087 | + '{{WRAPPER}} .ui-e-testimonial-divider' => 'border-color: {{VALUE}};', | |
| 1088 | + ], | |
| 1089 | + ] | |
| 1090 | + ); | |
| 1091 | + $this->add_responsive_control( | |
| 1092 | + 'divider_spacing', | |
| 1093 | + [ | |
| 1094 | + 'label' => __('Spacing', 'uicore-elements'), | |
| 1095 | + 'type' => Controls_Manager::SLIDER, | |
| 1096 | + 'default' => [ | |
| 1097 | + 'size' => 20, | |
| 1098 | + 'unit' => 'px' | |
| 1099 | + ], | |
| 1100 | + 'selectors' => [ | |
| 1101 | + '{{WRAPPER}} .ui-e-testimonial-divider' => 'margin-bottom: {{SIZE}}{{UNIT}};', | |
| 1102 | + ], | |
| 1103 | + ] | |
| 1104 | + ); | |
| 1105 | + | |
| 1106 | + $this->end_controls_section(); | |
| 1107 | + } | |
| 1108 | + | |
| 1109 | + // Register all Style Controls at once but Cards Controls since different widgets may/may not require an 'active' state | |
| 1110 | + function TRAIT_register_style_controls() | |
| 1111 | + { | |
| 1112 | + $this->register_testimonial_image_controls(); | |
| 1113 | + $this->register_testimonial_name_controls(); | |
| 1114 | + $this->register_testimonial_job_controls(); | |
| 1115 | + $this->register_testimonial_text_controls(); | |
| 1116 | + $this->register_testimonial_rating_controls(); | |
| 1117 | + $this->register_testimonial_divider_controls(); | |
| 1118 | + } | |
| 1119 | + // Register all Animation Controls at once | |
| 1120 | + function TRAIT_register_testimonial_animation_controls() | |
| 1121 | + { | |
| 1122 | + $this->TRAIT_register_entrance_animations_controls(); // animate each item | |
| 1123 | + // Hover Animations -- IMPORTANT: any new animation added here must also be added on condition list to the animation wrapper at TRAIT_render_review_item() | |
| 1124 | + $this->TRAIT_register_hover_animation_control( | |
| 1125 | + 'Item Hover Animation', | |
| 1126 | + [], | |
| 1127 | + ['underline'] | |
| 1128 | + ); | |
| 1129 | + $this->TRAIT_register_hover_animation_control( | |
| 1130 | + 'Image Animations', | |
| 1131 | + ['show_reviewer_image' => 'yes'], | |
| 1132 | + ['underline'] | |
| 1133 | + ); | |
| 1134 | + $this->TRAIT_register_hover_animation_control( | |
| 1135 | + 'Avatar Animations', | |
| 1136 | + ['show_reviewer_avatar' => 'yes'], | |
| 1137 | + ['underline'] | |
| 1138 | + ); | |
| 1139 | + $this->TRAIT_register_hover_animation_control( | |
| 1140 | + 'Text Animations', | |
| 1141 | + ['show_reviewer_text' => 'yes'], | |
| 1142 | + ['zoom', 'underline'] | |
| 1143 | + ); | |
| 1144 | + $this->TRAIT_register_hover_animation_control( | |
| 1145 | + 'Name Animations', | |
| 1146 | + ['show_reviewer_name' => 'yes'], | |
| 1147 | + ['zoom'] | |
| 1148 | + ); | |
| 1149 | + $this->TRAIT_register_hover_animation_control( | |
| 1150 | + 'Job Animations', | |
| 1151 | + ['show_reviewer_job_title' => 'yes'], | |
| 1152 | + ['zoom'] | |
| 1153 | + ); | |
| 1154 | + $this->TRAIT_register_hover_animation_control( | |
| 1155 | + 'Rating Animations', | |
| 1156 | + ['show_reviewer_rating' => 'yes'], | |
| 1157 | + ['underline'] | |
| 1158 | + ); | |
| 1159 | + } | |
| 1160 | + // Register specific Controls that can't be called in blocks because are positioned differently on widgets, or used only by specific testimonial types, such as grid or carousel | |
| 1161 | + function TRAIT_register_specific_testimonial_controls($arg) | |
| 1162 | + { | |
| 1163 | + | |
| 1164 | + switch ($arg) { | |
| 1165 | + case 'layout': | |
| 1166 | + $this->add_control( | |
| 1167 | + 'layout', | |
| 1168 | + [ | |
| 1169 | + 'label' => esc_html__('Layout', 'uicore-elements'), | |
| 1170 | + 'type' => Controls_Manager::SELECT, | |
| 1171 | + 'default' => 'layout_1', | |
| 1172 | + 'options' => [ | |
| 1173 | + 'layout_1' => esc_html__('Layout 1', 'uicore-elements'), | |
| 1174 | + 'layout_2' => esc_html__('Layout 2', 'uicore-elements'), | |
| 1175 | + 'layout_3' => esc_html__('Layout 3', 'uicore-elements'), | |
| 1176 | + 'layout_4' => esc_html__('Layout 4', 'uicore-elements'), | |
| 1177 | + 'layout_5' => esc_html__('Layout 5', 'uicore-elements'), | |
| 1178 | + 'layout_6' => esc_html__('Layout 6', 'uicore-elements'), | |
| 1179 | + ], | |
| 1180 | + 'render_type' => 'template', | |
| 1181 | + 'prefix_class' => 'ui-e-', | |
| 1182 | + 'frontend_available' => true | |
| 1183 | + ] | |
| 1184 | + ); | |
| 1185 | + break; | |
| 1186 | + | |
| 1187 | + case 'item_animations': | |
| 1188 | + $this->add_control( | |
| 1189 | + 'item_hover_animation', | |
| 1190 | + [ | |
| 1191 | + 'label' => esc_html__('Item Hover Animation', 'uicore-elements'), | |
| 1192 | + 'type' => Controls_Manager::SELECT, | |
| 1193 | + 'default' => '', | |
| 1194 | + 'label_block' => true, | |
| 1195 | + 'options' => $this->get_animations(), | |
| 1196 | + ] | |
| 1197 | + ); | |
| 1198 | + break; | |
| 1199 | + } | |
| 1200 | + } | |
| 1201 | + | |
| 1202 | + // HTML Rendering Functions | |
| 1203 | + function render_reviewer_avatar($item) | |
| 1204 | + { | |
| 1205 | + $settings = $this->get_settings_for_display(); | |
| 1206 | + $fit_avatar = ($this->is_option('avatar_size') && $settings['avatar_size']['unit'] === 'px') | |
| 1207 | + ? 'ui-avatar-fit' | |
| 1208 | + : ''; | |
| 1209 | + | |
| 1210 | + if (! $settings['show_reviewer_avatar']) { | |
| 1211 | + return; | |
| 1212 | + } | |
| 1213 | + | |
| 1214 | +?> | |
| 1215 | + <div class="ui-e-testimonial-avatar <?php echo esc_attr($settings['avatar_animations']); ?> <?php echo esc_attr($fit_avatar); ?>"> | |
| 1216 | + <?php | |
| 1217 | + $avatar_url = Group_Control_Image_Size::get_attachment_image_src($item['avatar']['id'], 'avatar_media_size', $settings); | |
| 1218 | + if (!$avatar_url) { | |
| 1219 | + printf('<img src="%1$s" alt="%2$s">', esc_url($item['avatar']['url']), esc_html($item['reviewer_name'])); | |
| 1220 | + } else { | |
| 1221 | + print(wp_get_attachment_image( | |
| 1222 | + $item['avatar']['id'], | |
| 1223 | + $settings['avatar_media_size_size'], | |
| 1224 | + false, | |
| 1225 | + [ | |
| 1226 | + 'alt' => esc_html($item['reviewer_name']) | |
| 1227 | + ] | |
| 1228 | + )); | |
| 1229 | + } | |
| 1230 | + ?> | |
| 1231 | + </div> | |
| 1232 | + <?php | |
| 1233 | + } | |
| 1234 | + function render_reviewer_secondary_image($item) | |
| 1235 | + { | |
| 1236 | + $settings = $this->get_settings_for_display(); | |
| 1237 | + | |
| 1238 | + $thumb_url = Group_Control_Image_Size::get_attachment_image_src($item['image']['id'], 'image_media_size', $settings); | |
| 1239 | + | |
| 1240 | + if (! $settings['show_reviewer_image'] || !$thumb_url) { | |
| 1241 | + return; | |
| 1242 | + } | |
| 1243 | + | |
| 1244 | + ?> | |
| 1245 | + <div class="ui-e-testimonial-image <?php echo esc_attr($settings['image_animations']); ?>"> | |
| 1246 | + <?php | |
| 1247 | + if ($thumb_url) { | |
| 1248 | + print(wp_get_attachment_image( | |
| 1249 | + $item['image']['id'], | |
| 1250 | + $settings['image_media_size_size'], | |
| 1251 | + false, | |
| 1252 | + [] | |
| 1253 | + )); | |
| 1254 | + } | |
| 1255 | + ?> | |
| 1256 | + </div> | |
| 1257 | + <?php | |
| 1258 | + } | |
| 1259 | + function render_reviewer_name($item) | |
| 1260 | + { | |
| 1261 | + $settings = $this->get_settings_for_display(); | |
| 1262 | + | |
| 1263 | + if (! $settings['show_reviewer_name']) { | |
| 1264 | + return; | |
| 1265 | + } | |
| 1266 | + | |
| 1267 | + ?> | |
| 1268 | + <?php if ($item['reviewer_name']) : ?> | |
| 1269 | + <<?php echo Helper::esc_tag($settings['review_name_tag']); ?> class="ui-e-testimonial-name <?php echo esc_attr($settings['name_animations']); ?>"> | |
| 1270 | + <span><?php echo wp_kses_post($item['reviewer_name']); ?></span> | |
| 1271 | + </<?php echo Helper::esc_tag($settings['review_name_tag']); ?>> | |
| 1272 | + <?php endif; ?> | |
| 1273 | + <?php | |
| 1274 | + } | |
| 1275 | + function render_reviewer_job_title($item) | |
| 1276 | + { | |
| 1277 | + $settings = $this->get_settings_for_display(); | |
| 1278 | + | |
| 1279 | + if (! $settings['show_reviewer_job_title']) { | |
| 1280 | + return; | |
| 1281 | + } | |
| 1282 | + | |
| 1283 | + ?> | |
| 1284 | + <?php if ($item['reviewer_job_title']) : ?> | |
| 1285 | + <div class="ui-e-testimonial-job-title <?php echo esc_attr($settings['job_animations']); ?>"> | |
| 1286 | + <span><?php echo esc_html($item['reviewer_job_title']); ?></span> | |
| 1287 | + </div> | |
| 1288 | + <?php endif; ?> | |
| 1289 | + <?php | |
| 1290 | + } | |
| 1291 | + function render_review_text($item) | |
| 1292 | + { | |
| 1293 | + $settings = $this->get_settings_for_display(); | |
| 1294 | + | |
| 1295 | + if (! $settings['show_reviewer_text']) { | |
| 1296 | + return; | |
| 1297 | + } | |
| 1298 | + | |
| 1299 | + ?> | |
| 1300 | + <?php if ($item['review_text']) : ?> | |
| 1301 | + <div class="ui-e-testimonial-text <?php echo esc_attr($settings['text_animations']); ?>"> | |
| 1302 | + <?php echo wp_kses_post($this->parse_text_editor($item['review_text'])); ?> | |
| 1303 | + </div> | |
| 1304 | + <?php endif; ?> | |
| 1305 | + <?php | |
| 1306 | + } | |
| 1307 | + function render_review_rating($item) | |
| 1308 | + { | |
| 1309 | + | |
| 1310 | + $settings = $this->get_settings_for_display(); | |
| 1311 | + | |
| 1312 | + $ID = $item['_id']; | |
| 1313 | + if (!$settings['show_reviewer_rating']) { | |
| 1314 | + return; | |
| 1315 | + } | |
| 1316 | + | |
| 1317 | + $rating_value = $item['rating_number']['size']; // get rating value | |
| 1318 | + | |
| 1319 | + if ($settings['rating_type'] == 'star') { | |
| 1320 | + | |
| 1321 | + ?> | |
| 1322 | + <div class="ui-e-testimonial-rating <?php echo esc_attr($settings['rating_animations']); ?>"> | |
| 1323 | + <?php | |
| 1324 | + | |
| 1325 | + $rating_scale = 5; | |
| 1326 | + | |
| 1327 | + if ('' === $rating_value) { | |
| 1328 | + $rating_value = $rating_scale; | |
| 1329 | + } | |
| 1330 | + | |
| 1331 | + $rating_value = floatval($rating_value); | |
| 1332 | + $rating_value = round($rating_value, 2); | |
| 1333 | + | |
| 1334 | + for ($index = 1; $index <= $rating_scale; $index++) { | |
| 1335 | + | |
| 1336 | + // SVG Method (uses font-awesome library for it's half-star icon, and can prints full and half-star) | |
| 1337 | + if (Plugin::$instance->experiments->is_feature_active('e_font_icon_svg')) { | |
| 1338 | + ?> | |
| 1339 | + <div class="ui-e-icon"> | |
| 1340 | + <?php | |
| 1341 | + if ($rating_value >= $index) { | |
| 1342 | + echo Icons_Manager::try_get_icon_html(['value' => 'fas fa-star', 'library' => 'fa-solid'], ['aria-hidden' => 'true']); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1343 | + } elseif (intval(ceil($rating_value)) === $index) { | |
| 1344 | + echo Icons_Manager::try_get_icon_html(['value' => 'fas fa-star-half', 'library' => 'fa-solid'], ['aria-hidden' => 'true']); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1345 | + } | |
| 1346 | + ?> | |
| 1347 | + </div> | |
| 1348 | + <?php | |
| 1349 | + // Font Icon Method (uses elementor library and can print decimal specific stars) | |
| 1350 | + } else { | |
| 1351 | + | |
| 1352 | + if ($rating_value >= $index) { | |
| 1353 | + $width = '100%'; // Full star if rate superior to current loop | |
| 1354 | + } elseif (intval(ceil($rating_value)) === $index) { | |
| 1355 | + $width = ($rating_value - ($index - 1)) * 100 . '%'; // Semi-star, calculating the width based on the decimal value | |
| 1356 | + } else { | |
| 1357 | + $width = '0%'; // No star if rate inferior to current loop | |
| 1358 | + } | |
| 1359 | + | |
| 1360 | + // Creates the atts | |
| 1361 | + $this->add_render_attribute("icon_marked_$ID" . "_$index", [ | |
| 1362 | + 'class' => 'ui-e-marked', | |
| 1363 | + ]); | |
| 1364 | + if ('100%' !== $width) { | |
| 1365 | + $this->add_render_attribute("icon_marked_$ID" . "_$index", [ | |
| 1366 | + 'style' => '--ui-e-rate-width: ' . $width . ';', | |
| 1367 | + ]); | |
| 1368 | + } | |
| 1369 | + | |
| 1370 | + ?> | |
| 1371 | + <div class="ui-e-icon"> | |
| 1372 | + <div <?php $this->print_render_attribute_string("icon_marked_$ID" . "_$index",); ?>> | |
| 1373 | + <?php echo Icons_Manager::try_get_icon_html(['value' => 'eicon-star', 'library' => 'eicons'], ['aria-hidden' => 'true']); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1374 | + ?> | |
| 1375 | + </div> | |
| 1376 | + <div class="ui-e-unmarked"> | |
| 1377 | + <?php echo Icons_Manager::try_get_icon_html(['value' => 'eicon-star', 'library' => 'eicons'], ['aria-hidden' => 'true']); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1378 | + ?> | |
| 1379 | + </div> | |
| 1380 | + </div> | |
| 1381 | + <?php | |
| 1382 | + } | |
| 1383 | + } | |
| 1384 | + ?> | |
| 1385 | + </div> | |
| 1386 | + <?php | |
| 1387 | + | |
| 1388 | + } else { // number type rating | |
| 1389 | + ?> | |
| 1390 | + <div class="ui-e-testimonial-rating number"> | |
| 1391 | + <span><?php echo esc_html($rating_value); ?></span> | |
| 1392 | + </div> | |
| 1393 | + <?php | |
| 1394 | + } | |
| 1395 | + } | |
| 1396 | + function render_review_divider() | |
| 1397 | + { | |
| 1398 | + $settings = $this->get_settings_for_display(); | |
| 1399 | + | |
| 1400 | + if (!$settings['show_reviewer_divider']) { | |
| 1401 | + return; | |
| 1402 | + } | |
| 1403 | + | |
| 1404 | + ?> | |
| 1405 | + <span class="ui-e-testimonial-divider"></span> | |
| 1406 | + <?php | |
| 1407 | + } | |
| 1408 | + function TRAIT_render_review_item($item, $layout) | |
| 1409 | + { | |
| 1410 | + $settings = $this->get_settings_for_display(); | |
| 1411 | + | |
| 1412 | + // Atts used by some layouts | |
| 1413 | + $atts = [ | |
| 1414 | + 'inline' => $this->is_option('image_inline', 'yes') ? true : false, | |
| 1415 | + ]; | |
| 1416 | + | |
| 1417 | + // Get entrance and item hover animation classes | |
| 1418 | + $entrance = $this->is_option('animate_items', 'ui-e-grid-animate') ? 'elementor-invisible' : ''; | |
| 1419 | + $hover = isset($settings['item_hover_animation']) ? $settings['item_hover_animation'] : null; | |
| 1420 | + $animations = sprintf('%s %s', $entrance, $hover); | |
| 1421 | + | |
| 1422 | + // Get all elements animation control options (triggered by .ui-e-animations-wrp:hover) | |
| 1423 | + $animation_options = [ | |
| 1424 | + $settings['image_animations'], | |
| 1425 | + $settings['avatar_animations'], | |
| 1426 | + $settings['text_animations'], | |
| 1427 | + $settings['name_animations'], | |
| 1428 | + $settings['job_animations'], | |
| 1429 | + $settings['rating_animations'] | |
| 1430 | + ]; | |
| 1431 | + // get item animation only if is not slider, | |
| 1432 | + if (!str_contains($this->get_name(), 'slider')) { | |
| 1433 | + $animation_options[] = $settings['item_hover_animation']; | |
| 1434 | + } | |
| 1435 | + // check if any of the animation are set | |
| 1436 | + $has_animation = array_filter($animation_options, function ($value) { | |
| 1437 | + return $value !== ''; | |
| 1438 | + }); | |
| 1439 | + // and also check if entrance is set | |
| 1440 | + $has_animation = $entrance !== '' ? true : $has_animation; | |
| 1441 | + | |
| 1442 | + ?> | |
| 1443 | + | |
| 1444 | + <div class="ui-e-wrp swiper-slide"> | |
| 1445 | + <?php if (!empty($has_animation)) : ?> | |
| 1446 | + <div class="ui-e-animations-wrp <?php echo esc_attr($animations); ?>"> | |
| 1447 | + <?php endif; ?> | |
| 1448 | + <div class="ui-e-item"> | |
| 1449 | + <?php | |
| 1450 | + switch ($layout) { | |
| 1451 | + case 'layout_2': | |
| 1452 | + $this->render_layout_2($item, $atts); | |
| 1453 | + break; | |
| 1454 | + case 'layout_3': | |
| 1455 | + $this->render_layout_3($item, $atts); | |
| 1456 | + break; | |
| 1457 | + case 'layout_4': | |
| 1458 | + $this->render_layout_4($item); | |
| 1459 | + break; | |
| 1460 | + case 'layout_5': | |
| 1461 | + $this->render_layout_5($item); | |
| 1462 | + break; | |
| 1463 | + case 'layout_6': | |
| 1464 | + $this->render_layout_6($item); | |
| 1465 | + break; | |
| 1466 | + default: | |
| 1467 | + $this->render_layout_1($item, $atts); | |
| 1468 | + break; | |
| 1469 | + } | |
| 1470 | + ?> | |
| 1471 | + </div> | |
| 1472 | + <?php if (!empty($has_animation)) : ?> | |
| 1473 | + </div> | |
| 1474 | + <?php endif; ?> | |
| 1475 | + </div> | |
| 1476 | + <?php | |
| 1477 | + } | |
| 1478 | + | |
| 1479 | + // Layouts | |
| 1480 | + function render_layout_1($item, $atts) | |
| 1481 | + { | |
| 1482 | + | |
| 1483 | + $this->render_reviewer_secondary_image($item); | |
| 1484 | + ?> | |
| 1485 | + <div class="ui-e-content"> | |
| 1486 | + | |
| 1487 | + <?php $this->render_review_text($item); ?> | |
| 1488 | + | |
| 1489 | + <?php if ($atts['inline']) : ?> | |
| 1490 | + | |
| 1491 | + <div class="ui-e-testimonial-flex"> | |
| 1492 | + <?php $this->render_reviewer_avatar($item); ?> | |
| 1493 | + <div class="ui-e-inner-content"> | |
| 1494 | + <?php | |
| 1495 | + $this->render_reviewer_name($item); | |
| 1496 | + $this->render_reviewer_job_title($item); | |
| 1497 | + $this->render_review_rating($item); | |
| 1498 | + ?> | |
| 1499 | + </div> | |
| 1500 | + </div> | |
| 1501 | + | |
| 1502 | + <?php else : | |
| 1503 | + $this->render_reviewer_avatar($item); | |
| 1504 | + $this->render_reviewer_name($item); | |
| 1505 | + $this->render_reviewer_job_title($item); | |
| 1506 | + $this->render_review_rating($item); | |
| 1507 | + endif; ?> | |
| 1508 | + | |
| 1509 | + </div> | |
| 1510 | + <?php | |
| 1511 | + } | |
| 1512 | + function render_layout_2($item, $atts) | |
| 1513 | + { | |
| 1514 | + ?> | |
| 1515 | + <div class="ui-e-content"> | |
| 1516 | + | |
| 1517 | + <?php if ($atts['inline']) : ?> | |
| 1518 | + <div class="ui-e-testimonial-flex"> | |
| 1519 | + <?php $this->render_reviewer_avatar($item); ?> | |
| 1520 | + <div class="ui-e-inner-content"> | |
| 1521 | + <?php | |
| 1522 | + $this->render_reviewer_name($item); | |
| 1523 | + $this->render_reviewer_job_title($item); | |
| 1524 | + $this->render_review_rating($item); | |
| 1525 | + ?> | |
| 1526 | + </div> | |
| 1527 | + </div> | |
| 1528 | + | |
| 1529 | + <?php else : | |
| 1530 | + $this->render_reviewer_avatar($item); | |
| 1531 | + $this->render_reviewer_name($item); | |
| 1532 | + $this->render_reviewer_job_title($item); | |
| 1533 | + $this->render_review_rating($item); | |
| 1534 | + endif; ?> | |
| 1535 | + | |
| 1536 | + <?php $this->render_review_text($item); ?> | |
| 1537 | + </div> | |
| 1538 | + | |
| 1539 | + <?php | |
| 1540 | + $this->render_reviewer_secondary_image($item); | |
| 1541 | + } | |
| 1542 | + function render_layout_3($item, $atts) | |
| 1543 | + { | |
| 1544 | + $this->render_reviewer_secondary_image($item); | |
| 1545 | + ?> | |
| 1546 | + <div class="ui-e-content"> | |
| 1547 | + | |
| 1548 | + <?php | |
| 1549 | + $this->render_review_rating($item); | |
| 1550 | + $this->render_review_text($item); | |
| 1551 | + $this->render_review_divider(); | |
| 1552 | + ?> | |
| 1553 | + | |
| 1554 | + <?php if ($atts['inline']) : ?> | |
| 1555 | + | |
| 1556 | + <div class="ui-e-testimonial-flex"> | |
| 1557 | + <?php $this->render_reviewer_avatar($item); ?> | |
| 1558 | + <div class="ui-e-inner-content"> | |
| 1559 | + <?php $this->render_reviewer_name($item); ?> | |
| 1560 | + <?php $this->render_reviewer_job_title($item); ?> | |
| 1561 | + </div> | |
| 1562 | + </div> | |
| 1563 | + | |
| 1564 | + <?php else : | |
| 1565 | + $this->render_reviewer_avatar($item); | |
| 1566 | + $this->render_reviewer_name($item); | |
| 1567 | + $this->render_reviewer_job_title($item); | |
| 1568 | + endif; ?> | |
| 1569 | + </div> | |
| 1570 | + <?php | |
| 1571 | + } | |
| 1572 | + function render_layout_4($item) | |
| 1573 | + { | |
| 1574 | + ?> | |
| 1575 | + <div class="ui-e-testimonial-flex"> | |
| 1576 | + <?php $this->render_reviewer_avatar($item); ?> | |
| 1577 | + <?php $this->render_reviewer_secondary_image($item); ?> | |
| 1578 | + </div> | |
| 1579 | + | |
| 1580 | + <div class="ui-e-content"> | |
| 1581 | + <?php | |
| 1582 | + $this->render_review_text($item); | |
| 1583 | + $this->render_reviewer_name($item); | |
| 1584 | + $this->render_reviewer_job_title($item); | |
| 1585 | + $this->render_review_rating($item); | |
| 1586 | + ?> | |
| 1587 | + </div> | |
| 1588 | + <?php | |
| 1589 | + } | |
| 1590 | + function render_layout_5($item) | |
| 1591 | + { | |
| 1592 | + ?> | |
| 1593 | + <div class="ui-e-testimonial-flex"> | |
| 1594 | + <div class="ui-e-content"> | |
| 1595 | + | |
| 1596 | + <?php | |
| 1597 | + $this->render_reviewer_secondary_image($item); | |
| 1598 | + $this->render_review_text($item); | |
| 1599 | + $this->render_review_rating($item); | |
| 1600 | + $this->render_reviewer_name($item); | |
| 1601 | + $this->render_reviewer_job_title($item); | |
| 1602 | + ?> | |
| 1603 | + </div> | |
| 1604 | + <?php $this->render_reviewer_avatar($item); ?> | |
| 1605 | + </div> | |
| 1606 | + <?php | |
| 1607 | + } | |
| 1608 | + function render_layout_6($item) | |
| 1609 | + { | |
| 1610 | + ?> | |
| 1611 | + <div class="ui-e-testimonial-flex"> | |
| 1612 | + | |
| 1613 | + <?php $this->render_reviewer_avatar($item); ?> | |
| 1614 | + | |
| 1615 | + <div class="ui-e-content"> | |
| 1616 | + <?php | |
| 1617 | + $this->render_reviewer_name($item); | |
| 1618 | + $this->render_reviewer_job_title($item); | |
| 1619 | + $this->render_review_rating($item); | |
| 1620 | + $this->render_review_text($item); | |
| 1621 | + $this->render_reviewer_secondary_image($item); | |
| 1622 | + ?> | |
| 1623 | + </div> | |
| 1624 | + </div> | |
| 1625 | +<?php | |
| 1626 | + } | |
| 1627 | +} | |