| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 9 | 9 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 10 | -use Elementor\Modules\Promotions\Controls\Promotion_Control; | |
| 11 | 10 | |
| 12 | 11 | /** |
| 13 | 12 | * Elementor testimonial widget. |
| 14 | 13 | * |
| @@ -42,9 +41,9 @@ | ||
| 42 | 41 | * |
| 43 | 42 | * @return string Widget title. |
| 44 | 43 | */ |
| 45 | 44 | public function get_title() { |
| 46 | - return esc_html__( 'Testimonial', 'elementor' ); | |
| 45 | + return __( 'Testimonial', 'elementor' ); | |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | 48 | /** |
| 50 | 49 | * Get widget icon. |
| @@ -73,52 +72,9 @@ | ||
| 73 | 72 | public function get_keywords() { |
| 74 | 73 | return [ 'testimonial', 'blockquote' ]; |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | - protected function is_dynamic_content(): bool { | |
| 78 | - return false; | |
| 79 | - } | |
| 80 | - | |
| 81 | 76 | /** |
| 82 | - * Get style dependencies. | |
| 83 | - * | |
| 84 | - * Retrieve the list of style dependencies the widget requires. | |
| 85 | - * | |
| 86 | - * @since 3.24.0 | |
| 87 | - * @access public | |
| 88 | - * | |
| 89 | - * @return array Widget style dependencies. | |
| 90 | - */ | |
| 91 | - public function get_style_depends(): array { | |
| 92 | - return [ 'widget-testimonial' ]; | |
| 93 | - } | |
| 94 | - | |
| 95 | - public function has_widget_inner_wrapper(): bool { | |
| 96 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Get widget upsale data. | |
| 101 | - * | |
| 102 | - * Retrieve the widget promotion data. | |
| 103 | - * | |
| 104 | - * @since 3.18.0 | |
| 105 | - * @access protected | |
| 106 | - * | |
| 107 | - * @return array Widget promotion data. | |
| 108 | - */ | |
| 109 | - protected function get_upsale_data() { | |
| 110 | - return [ | |
| 111 | - 'condition' => ! Utils::has_pro(), | |
| 112 | - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ), | |
| 113 | - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ), | |
| 114 | - 'description' => esc_html__( 'Use interesting masonry layouts and other overlay features with Elementor\'s Pro Gallery widget.', 'elementor' ), | |
| 115 | - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-testimonial-widget/' ), | |
| 116 | - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ), | |
| 117 | - ]; | |
| 118 | - } | |
| 119 | - | |
| 120 | - /** | |
| 121 | 77 | * Register testimonial widget controls. |
| 122 | 78 | * |
| 123 | 79 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 124 | 80 | * |
| @@ -128,9 +84,9 @@ | ||
| 128 | 84 | protected function register_controls() { |
| 129 | 85 | $this->start_controls_section( |
| 130 | 86 | 'section_testimonial', |
| 131 | 87 | [ |
| 132 | - 'label' => esc_html__( 'Testimonial', 'elementor' ), | |
| 88 | + 'label' => __( 'Testimonial', 'elementor' ), | |
| 133 | 89 | ] |
| 134 | 90 | ); |
| 135 | 91 | |
| 136 | 92 | $this->add_control( |
| @@ -135,15 +91,15 @@ | ||
| 135 | 91 | |
| 136 | 92 | $this->add_control( |
| 137 | 93 | 'testimonial_content', |
| 138 | 94 | [ |
| 139 | - 'label' => esc_html__( 'Content', 'elementor' ), | |
| 95 | + 'label' => __( 'Content', 'elementor' ), | |
| 140 | 96 | 'type' => Controls_Manager::TEXTAREA, |
| 141 | 97 | 'dynamic' => [ |
| 142 | 98 | 'active' => true, |
| 143 | 99 | ], |
| 144 | 100 | 'rows' => '10', |
| 145 | - 'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ), | |
| 101 | + 'default' => __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ), | |
| 146 | 102 | ] |
| 147 | 103 | ); |
| 148 | 104 | |
| 149 | 105 | $this->add_control( |
| @@ -148,9 +104,9 @@ | ||
| 148 | 104 | |
| 149 | 105 | $this->add_control( |
| 150 | 106 | 'testimonial_image', |
| 151 | 107 | [ |
| 152 | - 'label' => esc_html__( 'Choose Image', 'elementor' ), | |
| 108 | + 'label' => __( 'Choose Image', 'elementor' ), | |
| 153 | 109 | 'type' => Controls_Manager::MEDIA, |
| 154 | 110 | 'dynamic' => [ |
| 155 | 111 | 'active' => true, |
| 156 | 112 | ], |
| @@ -164,8 +120,9 @@ | ||
| 164 | 120 | Group_Control_Image_Size::get_type(), |
| 165 | 121 | [ |
| 166 | 122 | 'name' => 'testimonial_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `testimonial_image_size` and `testimonial_image_custom_dimension`. |
| 167 | 123 | 'default' => 'full', |
| 124 | + 'separator' => 'none', | |
| 168 | 125 | ] |
| 169 | 126 | ); |
| 170 | 127 | |
| 171 | 128 | $this->add_control( |
| @@ -170,17 +127,14 @@ | ||
| 170 | 127 | |
| 171 | 128 | $this->add_control( |
| 172 | 129 | 'testimonial_name', |
| 173 | 130 | [ |
| 174 | - 'label' => esc_html__( 'Name', 'elementor' ), | |
| 131 | + 'label' => __( 'Name', 'elementor' ), | |
| 175 | 132 | 'type' => Controls_Manager::TEXT, |
| 176 | 133 | 'dynamic' => [ |
| 177 | 134 | 'active' => true, |
| 178 | 135 | ], |
| 179 | - 'ai' => [ | |
| 180 | - 'active' => false, | |
| 181 | - ], | |
| 182 | - 'default' => esc_html__( 'John Doe', 'elementor' ), | |
| 136 | + 'default' => 'John Doe', | |
| 183 | 137 | ] |
| 184 | 138 | ); |
| 185 | 139 | |
| 186 | 140 | $this->add_control( |
| @@ -185,17 +139,14 @@ | ||
| 185 | 139 | |
| 186 | 140 | $this->add_control( |
| 187 | 141 | 'testimonial_job', |
| 188 | 142 | [ |
| 189 | - 'label' => esc_html__( 'Title', 'elementor' ), | |
| 143 | + 'label' => __( 'Title', 'elementor' ), | |
| 190 | 144 | 'type' => Controls_Manager::TEXT, |
| 191 | 145 | 'dynamic' => [ |
| 192 | 146 | 'active' => true, |
| 193 | 147 | ], |
| 194 | - 'ai' => [ | |
| 195 | - 'active' => false, | |
| 196 | - ], | |
| 197 | - 'default' => esc_html__( 'Designer', 'elementor' ), | |
| 148 | + 'default' => 'Designer', | |
| 198 | 149 | ] |
| 199 | 150 | ); |
| 200 | 151 | |
| 201 | 152 | $this->add_control( |
| @@ -200,13 +151,14 @@ | ||
| 200 | 151 | |
| 201 | 152 | $this->add_control( |
| 202 | 153 | 'link', |
| 203 | 154 | [ |
| 204 | - 'label' => esc_html__( 'Link', 'elementor' ), | |
| 155 | + 'label' => __( 'Link', 'elementor' ), | |
| 205 | 156 | 'type' => Controls_Manager::URL, |
| 206 | 157 | 'dynamic' => [ |
| 207 | 158 | 'active' => true, |
| 208 | 159 | ], |
| 160 | + 'placeholder' => __( 'https://your-link.com', 'elementor' ), | |
| 209 | 161 | ] |
| 210 | 162 | ); |
| 211 | 163 | |
| 212 | 164 | $this->add_control( |
| @@ -211,63 +163,56 @@ | ||
| 211 | 163 | |
| 212 | 164 | $this->add_control( |
| 213 | 165 | 'testimonial_image_position', |
| 214 | 166 | [ |
| 215 | - 'label' => esc_html__( 'Image Position', 'elementor' ), | |
| 216 | - 'type' => Controls_Manager::CHOOSE, | |
| 167 | + 'label' => __( 'Image Position', 'elementor' ), | |
| 168 | + 'type' => Controls_Manager::SELECT, | |
| 217 | 169 | 'default' => 'aside', |
| 218 | 170 | 'options' => [ |
| 219 | - 'aside' => [ | |
| 220 | - 'title' => esc_html__( 'Aside', 'elementor' ), | |
| 221 | - 'icon' => 'eicon-h-align-left', | |
| 222 | - ], | |
| 223 | - 'top' => [ | |
| 224 | - 'title' => esc_html__( 'Top', 'elementor' ), | |
| 225 | - 'icon' => 'eicon-v-align-top', | |
| 226 | - ], | |
| 171 | + 'aside' => __( 'Aside', 'elementor' ), | |
| 172 | + 'top' => __( 'Top', 'elementor' ), | |
| 227 | 173 | ], |
| 228 | - 'toggle' => false, | |
| 229 | 174 | 'condition' => [ |
| 230 | 175 | 'testimonial_image[url]!' => '', |
| 231 | 176 | ], |
| 232 | 177 | 'separator' => 'before', |
| 233 | - 'classes' => 'elementor-control-start-end', | |
| 234 | 178 | 'style_transfer' => true, |
| 235 | 179 | ] |
| 236 | 180 | ); |
| 237 | 181 | |
| 238 | - $this->add_responsive_control( | |
| 182 | + $this->add_control( | |
| 239 | 183 | 'testimonial_alignment', |
| 240 | 184 | [ |
| 241 | - 'label' => esc_html__( 'Alignment', 'elementor' ), | |
| 185 | + 'label' => __( 'Alignment', 'elementor' ), | |
| 242 | 186 | 'type' => Controls_Manager::CHOOSE, |
| 243 | 187 | 'default' => 'center', |
| 244 | 188 | 'options' => [ |
| 245 | - 'start' => [ | |
| 246 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 189 | + 'left' => [ | |
| 190 | + 'title' => __( 'Left', 'elementor' ), | |
| 247 | 191 | 'icon' => 'eicon-text-align-left', |
| 248 | 192 | ], |
| 249 | 193 | 'center' => [ |
| 250 | - 'title' => esc_html__( 'Center', 'elementor' ), | |
| 194 | + 'title' => __( 'Center', 'elementor' ), | |
| 251 | 195 | 'icon' => 'eicon-text-align-center', |
| 252 | 196 | ], |
| 253 | - 'end' => [ | |
| 254 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 197 | + 'right' => [ | |
| 198 | + 'title' => __( 'Right', 'elementor' ), | |
| 255 | 199 | 'icon' => 'eicon-text-align-right', |
| 256 | 200 | ], |
| 257 | 201 | ], |
| 258 | - 'classes' => 'elementor-control-start-end', | |
| 259 | - 'selectors_dictionary' => [ | |
| 260 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 261 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 262 | - ], | |
| 263 | - 'selectors' => [ | |
| 264 | - '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}', | |
| 265 | - ], | |
| 266 | 202 | 'style_transfer' => true, |
| 267 | 203 | ] |
| 268 | 204 | ); |
| 269 | 205 | |
| 206 | + $this->add_control( | |
| 207 | + 'view', | |
| 208 | + [ | |
| 209 | + 'label' => __( 'View', 'elementor' ), | |
| 210 | + 'type' => Controls_Manager::HIDDEN, | |
| 211 | + 'default' => 'traditional', | |
| 212 | + ] | |
| 213 | + ); | |
| 214 | + | |
| 270 | 215 | $this->end_controls_section(); |
| 271 | 216 | |
| 272 | 217 | // Content. |
| 273 | 218 | $this->start_controls_section( |
| @@ -272,9 +217,9 @@ | ||
| 272 | 217 | // Content. |
| 273 | 218 | $this->start_controls_section( |
| 274 | 219 | 'section_style_testimonial_content', |
| 275 | 220 | [ |
| 276 | - 'label' => esc_html__( 'Content', 'elementor' ), | |
| 221 | + 'label' => __( 'Content', 'elementor' ), | |
| 277 | 222 | 'tab' => Controls_Manager::TAB_STYLE, |
| 278 | 223 | ] |
| 279 | 224 | ); |
| 280 | 225 | |
| @@ -280,9 +225,9 @@ | ||
| 280 | 225 | |
| 281 | 226 | $this->add_control( |
| 282 | 227 | 'content_content_color', |
| 283 | 228 | [ |
| 284 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 229 | + 'label' => __( 'Text Color', 'elementor' ), | |
| 285 | 230 | 'type' => Controls_Manager::COLOR, |
| 286 | 231 | 'global' => [ |
| 287 | 232 | 'default' => Global_Colors::COLOR_TEXT, |
| 288 | 233 | ], |
| @@ -317,9 +262,9 @@ | ||
| 317 | 262 | // Image. |
| 318 | 263 | $this->start_controls_section( |
| 319 | 264 | 'section_style_testimonial_image', |
| 320 | 265 | [ |
| 321 | - 'label' => esc_html__( 'Image', 'elementor' ), | |
| 266 | + 'label' => __( 'Image', 'elementor' ), | |
| 322 | 267 | 'tab' => Controls_Manager::TAB_STYLE, |
| 323 | 268 | 'condition' => [ |
| 324 | 269 | 'testimonial_image[url]!' => '', |
| 325 | 270 | ], |
| @@ -325,14 +270,14 @@ | ||
| 325 | 270 | ], |
| 326 | 271 | ] |
| 327 | 272 | ); |
| 328 | 273 | |
| 329 | - $this->add_responsive_control( | |
| 274 | + $this->add_control( | |
| 330 | 275 | 'image_size', |
| 331 | 276 | [ |
| 332 | - 'label' => esc_html__( 'Image Resolution', 'elementor' ), | |
| 277 | + 'label' => __( 'Image Size', 'elementor' ), | |
| 333 | 278 | 'type' => Controls_Manager::SLIDER, |
| 334 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 279 | + 'size_units' => [ 'px' ], | |
| 335 | 280 | 'range' => [ |
| 336 | 281 | 'px' => [ |
| 337 | 282 | 'min' => 20, |
| 338 | 283 | 'max' => 200, |
| @@ -352,14 +297,14 @@ | ||
| 352 | 297 | 'separator' => 'before', |
| 353 | 298 | ] |
| 354 | 299 | ); |
| 355 | 300 | |
| 356 | - $this->add_responsive_control( | |
| 301 | + $this->add_control( | |
| 357 | 302 | 'image_border_radius', |
| 358 | 303 | [ |
| 359 | - 'label' => esc_html__( 'Border Radius', 'elementor' ), | |
| 304 | + 'label' => __( 'Border Radius', 'elementor' ), | |
| 360 | 305 | 'type' => Controls_Manager::DIMENSIONS, |
| 361 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], | |
| 306 | + 'size_units' => [ 'px', '%' ], | |
| 362 | 307 | 'selectors' => [ |
| 363 | 308 | '{{WRAPPER}} .elementor-testimonial-wrapper .elementor-testimonial-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 364 | 309 | ], |
| 365 | 310 | ] |
| @@ -370,9 +315,9 @@ | ||
| 370 | 315 | // Name. |
| 371 | 316 | $this->start_controls_section( |
| 372 | 317 | 'section_style_testimonial_name', |
| 373 | 318 | [ |
| 374 | - 'label' => esc_html__( 'Name', 'elementor' ), | |
| 319 | + 'label' => __( 'Name', 'elementor' ), | |
| 375 | 320 | 'tab' => Controls_Manager::TAB_STYLE, |
| 376 | 321 | ] |
| 377 | 322 | ); |
| 378 | 323 | |
| @@ -378,9 +323,9 @@ | ||
| 378 | 323 | |
| 379 | 324 | $this->add_control( |
| 380 | 325 | 'name_text_color', |
| 381 | 326 | [ |
| 382 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 327 | + 'label' => __( 'Text Color', 'elementor' ), | |
| 383 | 328 | 'type' => Controls_Manager::COLOR, |
| 384 | 329 | 'global' => [ |
| 385 | 330 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 386 | 331 | ], |
| @@ -415,9 +360,9 @@ | ||
| 415 | 360 | // Job. |
| 416 | 361 | $this->start_controls_section( |
| 417 | 362 | 'section_style_testimonial_job', |
| 418 | 363 | [ |
| 419 | - 'label' => esc_html__( 'Title', 'elementor' ), | |
| 364 | + 'label' => __( 'Title', 'elementor' ), | |
| 420 | 365 | 'tab' => Controls_Manager::TAB_STYLE, |
| 421 | 366 | ] |
| 422 | 367 | ); |
| 423 | 368 | |
| @@ -423,9 +368,9 @@ | ||
| 423 | 368 | |
| 424 | 369 | $this->add_control( |
| 425 | 370 | 'job_text_color', |
| 426 | 371 | [ |
| 427 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 372 | + 'label' => __( 'Text Color', 'elementor' ), | |
| 428 | 373 | 'type' => Controls_Manager::COLOR, |
| 429 | 374 | 'global' => [ |
| 430 | 375 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 431 | 376 | ], |
| @@ -468,19 +413,14 @@ | ||
| 468 | 413 | */ |
| 469 | 414 | protected function render() { |
| 470 | 415 | $settings = $this->get_settings_for_display(); |
| 471 | 416 | |
| 472 | - $has_content = ! empty( $settings['testimonial_content'] ); | |
| 473 | - $has_image = ! empty( $settings['testimonial_image']['url'] ); | |
| 474 | - $has_name = ! empty( $settings['testimonial_name'] ); | |
| 475 | - $has_job = ! empty( $settings['testimonial_job'] ); | |
| 417 | + $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' ); | |
| 476 | 418 | |
| 477 | - if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) { | |
| 478 | - return; | |
| 419 | + if ( $settings['testimonial_alignment'] ) { | |
| 420 | + $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-text-align-' . $settings['testimonial_alignment'] ); | |
| 479 | 421 | } |
| 480 | 422 | |
| 481 | - $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' ); | |
| 482 | - | |
| 483 | 423 | $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-meta' ); |
| 484 | 424 | |
| 485 | 425 | if ( $settings['testimonial_image']['url'] ) { |
| 486 | 426 | $this->add_render_attribute( 'meta', 'class', 'elementor-has-image' ); |
| @@ -489,23 +429,32 @@ | ||
| 489 | 429 | if ( $settings['testimonial_image_position'] ) { |
| 490 | 430 | $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-image-position-' . $settings['testimonial_image_position'] ); |
| 491 | 431 | } |
| 492 | 432 | |
| 433 | + $has_content = ! ! $settings['testimonial_content']; | |
| 434 | + $has_image = ! ! $settings['testimonial_image']['url']; | |
| 435 | + $has_name = ! ! $settings['testimonial_name']; | |
| 436 | + $has_job = ! ! $settings['testimonial_job']; | |
| 437 | + | |
| 438 | + if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) { | |
| 439 | + return; | |
| 440 | + } | |
| 441 | + | |
| 493 | 442 | if ( ! empty( $settings['link']['url'] ) ) { |
| 494 | 443 | $this->add_link_attributes( 'link', $settings['link'] ); |
| 495 | 444 | } |
| 496 | 445 | ?> |
| 497 | - <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>> | |
| 446 | + <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> | |
| 498 | 447 | <?php |
| 499 | 448 | if ( $has_content ) : |
| 500 | 449 | $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 501 | 450 | $this->add_inline_editing_attributes( 'testimonial_content' ); |
| 502 | 451 | ?> |
| 503 | - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div> | |
| 452 | + <div <?php echo $this->get_render_attribute_string( 'testimonial_content' ); ?>><?php echo $settings['testimonial_content']; ?></div> | |
| 504 | 453 | <?php endif; ?> |
| 505 | 454 | |
| 506 | 455 | <?php if ( $has_image || $has_name || $has_job ) : ?> |
| 507 | - <div <?php $this->print_render_attribute_string( 'meta' ); ?>> | |
| 456 | + <div <?php echo $this->get_render_attribute_string( 'meta' ); ?>> | |
| 508 | 457 | <div class="elementor-testimonial-meta-inner"> |
| 509 | 458 | <?php if ( $has_image ) : ?> |
| 510 | 459 | <div class="elementor-testimonial-image"> |
| 511 | 460 | <?php |
| @@ -512,9 +461,9 @@ | ||
| 512 | 461 | $image_html = Group_Control_Image_Size::get_attachment_image_html( $settings, 'testimonial_image' ); |
| 513 | 462 | if ( ! empty( $settings['link']['url'] ) ) : |
| 514 | 463 | $image_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $image_html . '</a>'; |
| 515 | 464 | endif; |
| 516 | - echo wp_kses_post( $image_html ); | |
| 465 | + echo $image_html; | |
| 517 | 466 | ?> |
| 518 | 467 | </div> |
| 519 | 468 | <?php endif; ?> |
| 520 | 469 | |
| @@ -524,15 +473,17 @@ | ||
| 524 | 473 | if ( $has_name ) : |
| 525 | 474 | $this->add_render_attribute( 'testimonial_name', 'class', 'elementor-testimonial-name' ); |
| 526 | 475 | $this->add_inline_editing_attributes( 'testimonial_name', 'none' ); |
| 527 | 476 | |
| 477 | + $testimonial_name_html = $settings['testimonial_name']; | |
| 478 | + | |
| 528 | 479 | if ( ! empty( $settings['link']['url'] ) ) : |
| 529 | 480 | ?> |
| 530 | - <a <?php $this->print_render_attribute_string( 'testimonial_name' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></a> | |
| 481 | + <a <?php echo $this->get_render_attribute_string( 'testimonial_name' ) . ' ' . $this->get_render_attribute_string( 'link' ); ?>><?php echo $testimonial_name_html; ?></a> | |
| 531 | 482 | <?php |
| 532 | 483 | else : |
| 533 | 484 | ?> |
| 534 | - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div> | |
| 485 | + <div <?php echo $this->get_render_attribute_string( 'testimonial_name' ); ?>><?php echo $testimonial_name_html; ?></div> | |
| 535 | 486 | <?php |
| 536 | 487 | endif; |
| 537 | 488 | endif; ?> |
| 538 | 489 | <?php |
| @@ -540,15 +491,17 @@ | ||
| 540 | 491 | $this->add_render_attribute( 'testimonial_job', 'class', 'elementor-testimonial-job' ); |
| 541 | 492 | |
| 542 | 493 | $this->add_inline_editing_attributes( 'testimonial_job', 'none' ); |
| 543 | 494 | |
| 495 | + $testimonial_job_html = $settings['testimonial_job']; | |
| 496 | + | |
| 544 | 497 | if ( ! empty( $settings['link']['url'] ) ) : |
| 545 | 498 | ?> |
| 546 | - <a <?php $this->print_render_attribute_string( 'testimonial_job' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></a> | |
| 499 | + <a <?php echo $this->get_render_attribute_string( 'testimonial_job' ) . ' ' . $this->get_render_attribute_string( 'link' ); ?>><?php echo $testimonial_job_html; ?></a> | |
| 547 | 500 | <?php |
| 548 | 501 | else : |
| 549 | 502 | ?> |
| 550 | - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div> | |
| 503 | + <div <?php echo $this->get_render_attribute_string( 'testimonial_job' ); ?>><?php echo $testimonial_job_html; ?></div> | |
| 551 | 504 | <?php |
| 552 | 505 | endif; |
| 553 | 506 | endif; ?> |
| 554 | 507 | </div> |
| @@ -567,41 +520,11 @@ | ||
| 567 | 520 | * |
| 568 | 521 | * @since 2.9.0 |
| 569 | 522 | * @access protected |
| 570 | 523 | */ |
| 571 | - public function render_markdown(): string { | |
| 572 | - $settings = $this->get_settings_for_display(); | |
| 573 | - | |
| 574 | - $content = Utils::html_to_plain_text( $settings['testimonial_content'] ?? '' ); | |
| 575 | - $name = Utils::html_to_plain_text( $settings['testimonial_name'] ?? '' ); | |
| 576 | - $job = Utils::html_to_plain_text( $settings['testimonial_job'] ?? '' ); | |
| 577 | - | |
| 578 | - if ( empty( $content ) && empty( $name ) ) { | |
| 579 | - return ''; | |
| 580 | - } | |
| 581 | - | |
| 582 | - $md = ''; | |
| 583 | - | |
| 584 | - if ( ! empty( $content ) ) { | |
| 585 | - $md = '> "' . $content . '"'; | |
| 586 | - } | |
| 587 | - | |
| 588 | - $attribution = array_filter( [ $name, $job ] ); | |
| 589 | - | |
| 590 | - if ( ! empty( $attribution ) ) { | |
| 591 | - $md .= "\n>\n> -- " . implode( ', ', $attribution ); | |
| 592 | - } | |
| 593 | - | |
| 594 | - return $md; | |
| 595 | - } | |
| 596 | - | |
| 597 | 524 | protected function content_template() { |
| 598 | 525 | ?> |
| 599 | 526 | <# |
| 600 | - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) { | |
| 601 | - return; | |
| 602 | - } | |
| 603 | - | |
| 604 | 527 | var image = { |
| 605 | 528 | id: settings.testimonial_image.id, |
| 606 | 529 | url: settings.testimonial_image.url, |
| 607 | 530 | size: settings.testimonial_image_size, |
| @@ -613,32 +536,24 @@ | ||
| 613 | 536 | if ( '' !== settings.testimonial_image.url ) { |
| 614 | 537 | imageUrl = elementor.imagesManager.getImageUrl( image ); |
| 615 | 538 | hasImage = ' elementor-has-image'; |
| 616 | 539 | |
| 617 | - var imageHtml = '<img src="' + _.escape( imageUrl ) + '" alt="testimonial" />'; | |
| 618 | - if ( settings.link?.url ) { | |
| 619 | - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + imageHtml + '</a>'; | |
| 540 | + var imageHtml = '<img src="' + imageUrl + '" alt="testimonial" />'; | |
| 541 | + if ( settings.link.url ) { | |
| 542 | + imageHtml = '<a href="' + settings.link.url + '">' + imageHtml + '</a>'; | |
| 620 | 543 | } |
| 621 | 544 | } |
| 622 | 545 | |
| 546 | + var testimonial_alignment = settings.testimonial_alignment ? ' elementor-testimonial-text-align-' + settings.testimonial_alignment : ''; | |
| 623 | 547 | var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : ''; |
| 624 | 548 | #> |
| 625 | - <div class="elementor-testimonial-wrapper"> | |
| 549 | + <div class="elementor-testimonial-wrapper{{ testimonial_alignment }}"> | |
| 626 | 550 | <# if ( '' !== settings.testimonial_content ) { |
| 627 | - view.addRenderAttribute( 'testimonial_content', { | |
| 628 | - 'data-binding-type': 'content', | |
| 629 | - 'data-binding-setting': 'testimonial_content', | |
| 630 | - 'data-binding-config': JSON.stringify({ | |
| 631 | - 'testimonial_content': { | |
| 632 | - editType: "text" | |
| 633 | - } | |
| 634 | - }) | |
| 635 | - } ); | |
| 636 | 551 | view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 637 | 552 | |
| 638 | 553 | view.addInlineEditingAttributes( 'testimonial_content' ); |
| 639 | 554 | #> |
| 640 | - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div> | |
| 555 | + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div> | |
| 641 | 556 | <# } #> |
| 642 | 557 | <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}"> |
| 643 | 558 | <div class="elementor-testimonial-meta-inner"> |
| 644 | 559 | <# if ( imageUrl ) { #> |
| @@ -660,15 +575,15 @@ | ||
| 660 | 575 | view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' ); |
| 661 | 576 | |
| 662 | 577 | view.addInlineEditingAttributes( 'testimonial_name', 'none' ); |
| 663 | 578 | |
| 664 | - if ( settings.link?.url ) { | |
| 579 | + if ( settings.link.url ) { | |
| 665 | 580 | #> |
| 666 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a> | |
| 581 | + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a> | |
| 667 | 582 | <# |
| 668 | 583 | } else { |
| 669 | 584 | #> |
| 670 | - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div> | |
| 585 | + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div> | |
| 671 | 586 | <# |
| 672 | 587 | } |
| 673 | 588 | } |
| 674 | 589 | |
| @@ -676,15 +591,15 @@ | ||
| 676 | 591 | view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' ); |
| 677 | 592 | |
| 678 | 593 | view.addInlineEditingAttributes( 'testimonial_job', 'none' ); |
| 679 | 594 | |
| 680 | - if ( settings.link?.url ) { | |
| 595 | + if ( settings.link.url ) { | |
| 681 | 596 | #> |
| 682 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a> | |
| 597 | + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a> | |
| 683 | 598 | <# |
| 684 | 599 | } else { |
| 685 | 600 | #> |
| 686 | - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div> | |
| 601 | + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div> | |
| 687 | 602 | <# |
| 688 | 603 | } |
| 689 | 604 | } |
| 690 | 605 | #> |