| @@ -148,22 +148,8 @@ | ||
| 148 | 148 | ] |
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | 151 | $this->add_control( |
| 152 | - 'title_display', | |
| 153 | - [ | |
| 154 | - 'label' => esc_html__( 'Display Title', 'elementor' ), | |
| 155 | - 'type' => Controls_Manager::SWITCHER, | |
| 156 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 157 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 158 | - 'default' => 'yes', | |
| 159 | - 'condition' => [ | |
| 160 | - 'title!' => '', | |
| 161 | - ], | |
| 162 | - ] | |
| 163 | - ); | |
| 164 | - | |
| 165 | - $this->add_control( | |
| 166 | 152 | 'progress_type', |
| 167 | 153 | [ |
| 168 | 154 | 'label' => esc_html__( 'Type', 'elementor' ), |
| 169 | 155 | 'type' => Controls_Manager::SELECT, |
| @@ -193,9 +179,8 @@ | ||
| 193 | 179 | ], |
| 194 | 180 | 'dynamic' => [ |
| 195 | 181 | 'active' => true, |
| 196 | 182 | ], |
| 197 | - 'separator' => 'before', | |
| 198 | 183 | ] |
| 199 | 184 | ); |
| 200 | 185 | |
| 201 | 186 | $this->add_control( |
| @@ -206,11 +191,8 @@ | ||
| 206 | 191 | 'label_on' => esc_html__( 'Show', 'elementor' ), |
| 207 | 192 | 'label_off' => esc_html__( 'Hide', 'elementor' ), |
| 208 | 193 | 'return_value' => 'show', |
| 209 | 194 | 'default' => 'show', |
| 210 | - 'condition' => [ | |
| 211 | - 'percent!' => '', | |
| 212 | - ], | |
| 213 | 195 | ] |
| 214 | 196 | ); |
| 215 | 197 | |
| 216 | 198 | $this->add_control( |
| @@ -223,9 +205,8 @@ | ||
| 223 | 205 | ], |
| 224 | 206 | 'placeholder' => esc_html__( 'e.g. Web Designer', 'elementor' ), |
| 225 | 207 | 'default' => esc_html__( 'Web Designer', 'elementor' ), |
| 226 | 208 | 'label_block' => true, |
| 227 | - 'separator' => 'before', | |
| 228 | 209 | ] |
| 229 | 210 | ); |
| 230 | 211 | |
| 231 | 212 | $this->end_controls_section(); |
| @@ -238,70 +219,8 @@ | ||
| 238 | 219 | ] |
| 239 | 220 | ); |
| 240 | 221 | |
| 241 | 222 | $this->add_control( |
| 242 | - 'title_heading', | |
| 243 | - [ | |
| 244 | - 'label' => esc_html__( 'Title', 'elementor' ), | |
| 245 | - 'type' => Controls_Manager::HEADING, | |
| 246 | - 'condition' => [ | |
| 247 | - 'title!' => '', | |
| 248 | - ], | |
| 249 | - ] | |
| 250 | - ); | |
| 251 | - | |
| 252 | - $this->add_control( | |
| 253 | - 'title_color', | |
| 254 | - [ | |
| 255 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 256 | - 'type' => Controls_Manager::COLOR, | |
| 257 | - 'selectors' => [ | |
| 258 | - '{{WRAPPER}} .elementor-title' => 'color: {{VALUE}};', | |
| 259 | - ], | |
| 260 | - 'global' => [ | |
| 261 | - 'default' => Global_Colors::COLOR_PRIMARY, | |
| 262 | - ], | |
| 263 | - 'condition' => [ | |
| 264 | - 'title!' => '', | |
| 265 | - ], | |
| 266 | - ] | |
| 267 | - ); | |
| 268 | - | |
| 269 | - $this->add_group_control( | |
| 270 | - Group_Control_Typography::get_type(), | |
| 271 | - [ | |
| 272 | - 'name' => 'typography', | |
| 273 | - 'selector' => '{{WRAPPER}} .elementor-title', | |
| 274 | - 'global' => [ | |
| 275 | - 'default' => Global_Typography::TYPOGRAPHY_TEXT, | |
| 276 | - ], | |
| 277 | - 'condition' => [ | |
| 278 | - 'title!' => '', | |
| 279 | - ], | |
| 280 | - ] | |
| 281 | - ); | |
| 282 | - | |
| 283 | - $this->add_group_control( | |
| 284 | - Group_Control_Text_Shadow::get_type(), | |
| 285 | - [ | |
| 286 | - 'name' => 'title_shadow', | |
| 287 | - 'selector' => '{{WRAPPER}} .elementor-title', | |
| 288 | - 'condition' => [ | |
| 289 | - 'title!' => '', | |
| 290 | - ], | |
| 291 | - ] | |
| 292 | - ); | |
| 293 | - | |
| 294 | - $this->add_control( | |
| 295 | - 'percentage_heading', | |
| 296 | - [ | |
| 297 | - 'label' => esc_html__( 'Percentage', 'elementor' ), | |
| 298 | - 'type' => Controls_Manager::HEADING, | |
| 299 | - 'separator' => 'before', | |
| 300 | - ] | |
| 301 | - ); | |
| 302 | - | |
| 303 | - $this->add_control( | |
| 304 | 223 | 'bar_color', |
| 305 | 224 | [ |
| 306 | 225 | 'label' => esc_html__( 'Color', 'elementor' ), |
| 307 | 226 | 'type' => Controls_Manager::COLOR, |
| @@ -354,11 +273,8 @@ | ||
| 354 | 273 | [ |
| 355 | 274 | 'label' => esc_html__( 'Inner Text', 'elementor' ), |
| 356 | 275 | 'type' => Controls_Manager::HEADING, |
| 357 | 276 | 'separator' => 'before', |
| 358 | - 'condition' => [ | |
| 359 | - 'inner_text!' => '', | |
| 360 | - ], | |
| 361 | 277 | ] |
| 362 | 278 | ); |
| 363 | 279 | |
| 364 | 280 | $this->add_control( |
| @@ -368,11 +284,8 @@ | ||
| 368 | 284 | 'type' => Controls_Manager::COLOR, |
| 369 | 285 | 'selectors' => [ |
| 370 | 286 | '{{WRAPPER}} .elementor-progress-bar' => 'color: {{VALUE}};', |
| 371 | 287 | ], |
| 372 | - 'condition' => [ | |
| 373 | - 'inner_text!' => '', | |
| 374 | - ], | |
| 375 | 288 | ] |
| 376 | 289 | ); |
| 377 | 290 | |
| 378 | 291 | $this->add_group_control( |
| @@ -382,11 +295,8 @@ | ||
| 382 | 295 | 'selector' => '{{WRAPPER}} .elementor-progress-bar', |
| 383 | 296 | 'exclude' => [ |
| 384 | 297 | 'line_height', |
| 385 | 298 | ], |
| 386 | - 'condition' => [ | |
| 387 | - 'inner_text!' => '', | |
| 388 | - ], | |
| 389 | 299 | ] |
| 390 | 300 | ); |
| 391 | 301 | |
| 392 | 302 | $this->add_group_control( |
| @@ -393,14 +303,54 @@ | ||
| 393 | 303 | Group_Control_Text_Shadow::get_type(), |
| 394 | 304 | [ |
| 395 | 305 | 'name' => 'bar_inner_shadow', |
| 396 | 306 | 'selector' => '{{WRAPPER}} .elementor-progress-bar', |
| 397 | - 'condition' => [ | |
| 398 | - 'inner_text!' => '', | |
| 307 | + ] | |
| 308 | + ); | |
| 309 | + | |
| 310 | + $this->end_controls_section(); | |
| 311 | + | |
| 312 | + $this->start_controls_section( | |
| 313 | + 'section_title', | |
| 314 | + [ | |
| 315 | + 'label' => esc_html__( 'Title Style', 'elementor' ), | |
| 316 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 317 | + ] | |
| 318 | + ); | |
| 319 | + | |
| 320 | + $this->add_control( | |
| 321 | + 'title_color', | |
| 322 | + [ | |
| 323 | + 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 324 | + 'type' => Controls_Manager::COLOR, | |
| 325 | + 'selectors' => [ | |
| 326 | + '{{WRAPPER}} .elementor-title' => 'color: {{VALUE}};', | |
| 399 | 327 | ], |
| 328 | + 'global' => [ | |
| 329 | + 'default' => Global_Colors::COLOR_PRIMARY, | |
| 330 | + ], | |
| 400 | 331 | ] |
| 401 | 332 | ); |
| 402 | 333 | |
| 334 | + $this->add_group_control( | |
| 335 | + Group_Control_Typography::get_type(), | |
| 336 | + [ | |
| 337 | + 'name' => 'typography', | |
| 338 | + 'selector' => '{{WRAPPER}} .elementor-title', | |
| 339 | + 'global' => [ | |
| 340 | + 'default' => Global_Typography::TYPOGRAPHY_TEXT, | |
| 341 | + ], | |
| 342 | + ] | |
| 343 | + ); | |
| 344 | + | |
| 345 | + $this->add_group_control( | |
| 346 | + Group_Control_Text_Shadow::get_type(), | |
| 347 | + [ | |
| 348 | + 'name' => 'title_shadow', | |
| 349 | + 'selector' => '{{WRAPPER}} .elementor-title', | |
| 350 | + ] | |
| 351 | + ); | |
| 352 | + | |
| 403 | 353 | $this->end_controls_section(); |
| 404 | 354 | } |
| 405 | 355 | |
| 406 | 356 | /** |
| @@ -426,28 +376,19 @@ | ||
| 426 | 376 | $progress_percentage = 100; |
| 427 | 377 | } |
| 428 | 378 | |
| 429 | 379 | if ( ! Utils::is_empty( $settings['title'] ) ) { |
| 380 | + $this->add_render_attribute( | |
| 381 | + 'title', | |
| 382 | + [ | |
| 383 | + 'class' => 'elementor-title', | |
| 384 | + 'id' => $progressbar_id, | |
| 385 | + ] | |
| 386 | + ); | |
| 430 | 387 | |
| 431 | - if ( 'yes' === $settings['title_display'] ) { | |
| 388 | + $this->add_inline_editing_attributes( 'title' ); | |
| 432 | 389 | |
| 433 | - $this->add_render_attribute( | |
| 434 | - 'title', | |
| 435 | - [ | |
| 436 | - 'class' => 'elementor-title', | |
| 437 | - 'id' => $progressbar_id, | |
| 438 | - ] | |
| 439 | - ); | |
| 440 | - | |
| 441 | - $this->add_inline_editing_attributes( 'title' ); | |
| 442 | - | |
| 443 | - $this->add_render_attribute( 'wrapper', 'aria-labelledby', $progressbar_id ); | |
| 444 | - | |
| 445 | - } else { | |
| 446 | - | |
| 447 | - $this->add_render_attribute( 'wrapper', 'aria-label', $settings['title'] ); | |
| 448 | - | |
| 449 | - } | |
| 390 | + $this->add_render_attribute( 'wrapper', 'aria-labelledby', $progressbar_id ); | |
| 450 | 391 | } |
| 451 | 392 | |
| 452 | 393 | $this->add_render_attribute( |
| 453 | 394 | 'wrapper', |
| @@ -479,9 +420,9 @@ | ||
| 479 | 420 | $this->add_render_attribute( 'inner_text', 'class', 'elementor-progress-text' ); |
| 480 | 421 | |
| 481 | 422 | $this->add_inline_editing_attributes( 'inner_text' ); |
| 482 | 423 | |
| 483 | - if ( ! Utils::is_empty( $settings['title'] ) && 'yes' === $settings['title_display'] ) { ?> | |
| 424 | + if ( ! Utils::is_empty( $settings['title'] ) ) { ?> | |
| 484 | 425 | <<?php Utils::print_validated_html_tag( $settings['title_tag'] ); ?> <?php $this->print_render_attribute_string( 'title' ); ?>> |
| 485 | 426 | <?php echo wp_kses_post( $settings['title'] ); ?> |
| 486 | 427 | </<?php Utils::print_validated_html_tag( $settings['title_tag'] ); ?>> |
| 487 | 428 | <?php } ?> |
| @@ -520,28 +461,19 @@ | ||
| 520 | 461 | progress_percentage = 100 < settings.percent.size ? 100 : settings.percent.size; |
| 521 | 462 | } |
| 522 | 463 | |
| 523 | 464 | if ( settings.title ) { |
| 465 | + view.addRenderAttribute( | |
| 466 | + 'title', | |
| 467 | + { | |
| 468 | + 'class': 'elementor-title', | |
| 469 | + 'id': progressbar_id, | |
| 470 | + } | |
| 471 | + ); | |
| 524 | 472 | |
| 525 | - if ( 'yes' === settings.title_display ) { | |
| 473 | + view.addInlineEditingAttributes( 'title' ); | |
| 526 | 474 | |
| 527 | - view.addRenderAttribute( | |
| 528 | - 'title', | |
| 529 | - { | |
| 530 | - 'class': 'elementor-title', | |
| 531 | - 'id': progressbar_id, | |
| 532 | - } | |
| 533 | - ); | |
| 534 | - | |
| 535 | - view.addInlineEditingAttributes( 'title' ); | |
| 536 | - | |
| 537 | - view.addRenderAttribute( 'progressWrapper', 'aria-labelledby', progressbar_id ); | |
| 538 | - | |
| 539 | - } else { | |
| 540 | - | |
| 541 | - view.addRenderAttribute( 'progressWrapper', 'aria-label', settings.title ); | |
| 542 | - | |
| 543 | - } | |
| 475 | + view.addRenderAttribute( 'wrapper', 'aria-labelledby', progressbar_id ); | |
| 544 | 476 | } |
| 545 | 477 | |
| 546 | 478 | view.addRenderAttribute( |
| 547 | 479 | 'progressWrapper', |
| @@ -561,9 +493,9 @@ | ||
| 561 | 493 | view.addRenderAttribute( 'inner_text', 'class', 'elementor-progress-text' ); |
| 562 | 494 | |
| 563 | 495 | view.addInlineEditingAttributes( 'inner_text' ); |
| 564 | 496 | #> |
| 565 | - <# if ( settings.title && 'yes' === settings.title_display ) { #> | |
| 497 | + <# if ( settings.title ) { #> | |
| 566 | 498 | <{{ title_tag }} {{{ view.getRenderAttributeString( 'title' ) }}}>{{ settings.title }}</{{ title_tag }}> |
| 567 | 499 | <# } #> |
| 568 | 500 | <div {{{ view.getRenderAttributeString( 'progressWrapper' ) }}}> |
| 569 | 501 | <div class="elementor-progress-bar" data-max="{{ progress_percentage }}"> |
| @@ -573,35 +505,6 @@ | ||
| 573 | 505 | <# } #> |
| 574 | 506 | </div> |
| 575 | 507 | </div> |
| 576 | 508 | <?php |
| 577 | - } | |
| 578 | - | |
| 579 | - public function render_markdown(): string { | |
| 580 | - $settings = $this->get_settings_for_display(); | |
| 581 | - $title = Utils::html_to_plain_text( $settings['title'] ?? '' ); | |
| 582 | - $inner_text = Utils::html_to_plain_text( $settings['inner_text'] ?? '' ); | |
| 583 | - $percent = $settings['percent']['size'] ?? ( $settings['percent'] ?? '' ); | |
| 584 | - | |
| 585 | - $parts = []; | |
| 586 | - | |
| 587 | - if ( ! empty( $title ) ) { | |
| 588 | - $parts[] = $title; | |
| 589 | - } | |
| 590 | - | |
| 591 | - if ( ! empty( $inner_text ) ) { | |
| 592 | - $parts[] = $inner_text; | |
| 593 | - } | |
| 594 | - | |
| 595 | - if ( empty( $parts ) && empty( $percent ) ) { | |
| 596 | - return ''; | |
| 597 | - } | |
| 598 | - | |
| 599 | - $label = implode( ' - ', $parts ); | |
| 600 | - | |
| 601 | - if ( ! empty( $percent ) ) { | |
| 602 | - return ! empty( $label ) ? $label . ': ' . $percent . '%' : $percent . '%'; | |
| 603 | - } | |
| 604 | - | |
| 605 | - return $label; | |
| 606 | 509 | } |
| 607 | 510 | } |