Welcome_Section.php (22140B)
1 <?php 2 3 namespace Welbim\Helper\Elementor\Widgets; 4 5 use Elementor\Utils; 6 use Elementor\Controls_Manager; 7 use Elementor\Widget_Base; 8 use Elementor\Plugin; 9 use \Elementor\Repeater; 10 use Elementor\Group_Control_Typography; 11 12 class Welcome_Section extends Widget_Base 13 { 14 15 16 public function get_name() 17 { 18 return 'welcome_section'; 19 } 20 21 public function get_title() 22 { 23 return esc_html__('welcome section', 'welbim'); 24 } 25 26 public function get_icon() 27 { 28 return 'sds-widget-ico'; 29 } 30 31 public function get_categories() 32 { 33 return array('Welbim'); 34 } 35 36 protected function _register_controls() 37 { 38 $this->start_controls_section( 39 'layout', 40 array( 41 'label' => __('Layout Style', 'welbim'), 42 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 43 ) 44 ); 45 46 $this->add_control( 47 'layout_style', 48 array( 49 'label' => __('Layout', 'welbim'), 50 'type' => \Elementor\Controls_Manager::SELECT, 51 'default' => '1', 52 'options' => array( 53 '1' => __('One', 'welbim'), 54 '2' => __('Two', 'welbim'), 55 '3' => __('Three', 'welbim'), 56 ), 57 ) 58 ); 59 60 $this->end_controls_section(); 61 62 $this->start_controls_section( 63 'general', 64 array( 65 'label' => esc_html__('General', 'welbim'), 66 ) 67 ); 68 69 $this->add_control( 70 'image_one', 71 array( 72 'label' => esc_html__('Image One', 'welbim'), 73 'type' => Controls_Manager::MEDIA, 74 'default' => array( 75 'url' => Utils::get_placeholder_image_src(), 76 ), 77 ) 78 ); 79 80 $this->add_control( 81 'image_two', 82 array( 83 'label' => esc_html__('Image Two', 'welbim'), 84 'type' => Controls_Manager::MEDIA, 85 'default' => array( 86 'url' => Utils::get_placeholder_image_src(), 87 ), 88 ) 89 ); 90 91 $this->add_control( 92 'sub_title', 93 array( 94 'label' => esc_html__('Tag Line', 'welbim'), 95 'type' => Controls_Manager::TEXT, 96 'default' => __('Welcome to Welbim', 'welbim'), 97 ) 98 ); 99 100 $this->add_control( 101 'title', 102 array( 103 'label' => esc_html__('Heading', 'welbim'), 104 'type' => Controls_Manager::TEXT, 105 'default' => __('We’re Committed <br>To quality', 'welbim'), 106 ) 107 ); 108 109 $this->add_control( 110 'bottom_title', 111 array( 112 'label' => esc_html__('Bottom Title', 'welbim'), 113 'type' => Controls_Manager::TEXT, 114 'default' => __('WELDER PRO PROFESSIONAL WELDING <br> COMPANY IN USA', 'welbim'), 115 ) 116 ); 117 118 $this->add_control( 119 'background_img', 120 array( 121 'label' => esc_html__('Background Image', 'welbim'), 122 'type' => Controls_Manager::MEDIA, 123 'default' => array( 124 'url' => Utils::get_placeholder_image_src(), 125 ), 126 ) 127 ); 128 129 $this->add_control( 130 'description', 131 array( 132 'label' => esc_html__('Description', 'welbim'), 133 'type' => Controls_Manager::TEXTAREA, 134 'rows' => 6, 135 'default' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. quis nostrud exercitation.', 'welbim'), 136 'placeholder' => esc_html__('Type your description here', 'welbim'), 137 ) 138 ); 139 140 $this->end_controls_section(); 141 142 $this->start_controls_section( 143 'item_right', 144 array( 145 'label' => esc_html__('Right Content', 'welbim'), 146 'conditions' => array( 147 'relation' => 'or', 148 'terms' => array( 149 array( 150 'name' => 'layout_style', 151 'operator' => '==', 152 'value' => '2', 153 ), 154 array( 155 'name' => 'layout_style', 156 'operator' => '==', 157 'value' => '3', 158 ), 159 ), 160 ), 161 ) 162 ); 163 164 $this->add_control( 165 'icon', 166 array( 167 'label' => __('Icon', 'plugin-domain'), 168 'type' => \Elementor\Controls_Manager::ICONS, 169 ) 170 ); 171 172 $this->add_control( 173 'right_title', 174 array( 175 'label' => __('Title', 'plugin-domain'), 176 'type' => \Elementor\Controls_Manager::TEXT, 177 ) 178 ); 179 180 $this->end_controls_section(); 181 182 $this->start_controls_section( 183 'progress', 184 array( 185 'label' => esc_html__('Progress', 'welbim'), 186 'conditions' => array( 187 'relation' => 'or', 188 'terms' => array( 189 array( 190 'name' => 'layout_style', 191 'operator' => '==', 192 'value' => '2', 193 ), 194 array( 195 'name' => 'layout_style', 196 'operator' => '==', 197 'value' => '3', 198 ), 199 ), 200 ), 201 ) 202 ); 203 204 $repeater0 = new Repeater(); 205 206 $repeater0->add_control( 207 'item_prog_title', 208 array( 209 'label' => esc_html__('Progress Title', 'welbim'), 210 'type' => Controls_Manager::TEXT, 211 'default' => __('Welding', 'welbim'), 212 ) 213 ); 214 215 $repeater0->add_control( 216 'item_prog_data', 217 array( 218 'label' => esc_html__('Progress Percent', 'welbim'), 219 'type' => Controls_Manager::TEXT, 220 'default' => __('91', 'welbim'), 221 ) 222 ); 223 224 $this->add_control( 225 'item_prog', 226 array( 227 'label' => esc_html__('Progress List', 'welbim'), 228 'type' => Controls_Manager::REPEATER, 229 'fields' => $repeater0->get_controls(), 230 'default' => array( 231 array( 232 'list_title' => esc_html__('Title #1', 'welbim'), 233 'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'), 234 ), 235 array( 236 'list_title' => esc_html__('Title #2', 'welbim'), 237 'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'), 238 ), 239 ), 240 ) 241 ); 242 243 $this->add_control( 244 'content1', 245 array( 246 'label' => esc_html__('Content', 'welbim'), 247 'type' => Controls_Manager::TEXTAREA, 248 ) 249 ); 250 251 $this->add_control( 252 'content2', 253 array( 254 'label' => esc_html__('Content Two', 'welbim'), 255 'type' => Controls_Manager::TEXTAREA, 256 ) 257 ); 258 259 $this->add_control( 260 'btn_title', 261 array( 262 'label' => esc_html__('Button Title', 'welbim'), 263 'type' => Controls_Manager::TEXT, 264 ) 265 ); 266 267 $this->add_control( 268 'btn_link', 269 array( 270 'label' => esc_html__('Button URL', 'welbim'), 271 'type' => Controls_Manager::TEXT, 272 ) 273 ); 274 275 $this->end_controls_section(); 276 277 $this->start_controls_section( 278 'item', 279 array( 280 'label' => esc_html__('Item One', 'welbim'), 281 'condition' => array( 282 'layout_style' => '1', 283 ), 284 ) 285 ); 286 287 $repeater1 = new Repeater(); 288 289 $repeater1->add_control( 290 'item_title', 291 array( 292 'label' => esc_html__('Title', 'welbim'), 293 'type' => Controls_Manager::TEXT, 294 'default' => __('We provide 24/7 service', 'welbim'), 295 ) 296 ); 297 298 $this->add_control( 299 'items1', 300 array( 301 'label' => esc_html__('Repeater List', 'welbim'), 302 'type' => Controls_Manager::REPEATER, 303 'fields' => $repeater1->get_controls(), 304 'default' => array( 305 array( 306 'list_title' => esc_html__('Title #1', 'welbim'), 307 'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'), 308 ), 309 array( 310 'list_title' => esc_html__('Title #2', 'welbim'), 311 'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'), 312 ), 313 ), 314 ) 315 ); 316 317 $this->end_controls_section(); 318 319 $this->start_controls_section( 320 'item2', 321 array( 322 'label' => esc_html__('Item Two', 'welbim'), 323 'condition' => array( 324 'layout_style' => '1', 325 ), 326 ) 327 ); 328 329 $repeater2 = new Repeater(); 330 331 $repeater2->add_control( 332 'icon', 333 array( 334 'label' => __('Icon', 'text-domain'), 335 'type' => \Elementor\Controls_Manager::ICONS, 336 ) 337 ); 338 339 $repeater2->add_control( 340 'item_title2', 341 array( 342 'label' => esc_html__('Title', 'welbim'), 343 'type' => Controls_Manager::TEXT, 344 'default' => __('Welding joins together', 'welbim'), 345 ) 346 ); 347 348 $this->add_control( 349 'items2', 350 array( 351 'label' => esc_html__('Repeater List', 'welbim'), 352 'type' => Controls_Manager::REPEATER, 353 'fields' => $repeater1->get_controls(), 354 'default' => array( 355 array( 356 'list_title' => esc_html__('Title #1', 'welbim'), 357 'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'), 358 ), 359 array( 360 'list_title' => esc_html__('Title #2', 'welbim'), 361 'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'), 362 ), 363 ), 364 ) 365 ); 366 367 $this->end_controls_section(); 368 369 $this->start_controls_section( 370 'typography_section', 371 array( 372 'label' => __('Typography Section', 'welbim'), 373 'tab' => Controls_Manager::TAB_STYLE, 374 ) 375 ); 376 377 $this->add_group_control( 378 Group_Control_Typography::get_type(), 379 array( 380 'name' => 'tagline_typography', 381 'label' => __('Tagline', 'welbim'), 382 'selector' => '{{WRAPPER}} .sec-title .sub-title', 383 384 ) 385 ); 386 387 $this->add_group_control( 388 Group_Control_Typography::get_type(), 389 array( 390 'name' => 'heading_typography', 391 'label' => __('Heading', 'welbim'), 392 'selector' => '{{WRAPPER}} .sec-title h2', 393 394 ) 395 ); 396 397 $this->add_group_control( 398 Group_Control_Typography::get_type(), 399 array( 400 'name' => 'bottom_title_typography', 401 'label' => __('Bottom Title', 'welbim'), 402 'selector' => '{{WRAPPER}} .welcome-section .note', 403 404 ) 405 ); 406 407 $this->add_group_control( 408 Group_Control_Typography::get_type(), 409 array( 410 'name' => 'Items_title_typography', 411 'label' => __('Items Title', 'welbim'), 412 'selector' => '{{WRAPPER}} .welcome-section .icon-box h4', 413 414 ) 415 ); 416 417 $this->end_controls_section(); 418 419 $this->start_controls_section( 420 'color_section', 421 array( 422 'label' => __('Color Section', 'welbim'), 423 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 424 ) 425 ); 426 427 $this->add_control( 428 'tagline_color', 429 array( 430 'label' => __('Tagline Color', 'welbim'), 431 'separator' => 'before', 432 'type' => \Elementor\Controls_Manager::COLOR, 433 'selectors' => array( 434 '{{WRAPPER}} .sec-title .sub-title' => 'color: {{VALUE}}', 435 ), 436 ) 437 ); 438 439 $this->add_control( 440 'heading_color', 441 array( 442 'label' => __('Heading Color', 'welbim'), 443 'separator' => 'before', 444 'type' => \Elementor\Controls_Manager::COLOR, 445 'selectors' => array( 446 '{{WRAPPER}} .sec-title h2' => 'color: {{VALUE}}', 447 ), 448 ) 449 ); 450 451 $this->add_control( 452 'bottom_title_color', 453 array( 454 'label' => __('Bottom Title Color', 'welbim'), 455 'separator' => 'before', 456 'type' => \Elementor\Controls_Manager::COLOR, 457 'selectors' => array( 458 '{{WRAPPER}} .welcome-section .note' => 'color: {{VALUE}}', 459 ), 460 ) 461 ); 462 463 $this->add_control( 464 'items_title_color', 465 array( 466 'label' => __('Items Title color', 'welbim'), 467 'separator' => 'before', 468 'type' => \Elementor\Controls_Manager::COLOR, 469 'selectors' => array( 470 '{{WRAPPER}} .welcome-section .icon-box h4' => 'color: {{VALUE}}', 471 ), 472 ) 473 ); 474 475 $this->add_control( 476 'items_icon_color', 477 array( 478 'label' => __('Items Icon Color', 'welbim'), 479 'separator' => 'before', 480 'type' => \Elementor\Controls_Manager::COLOR, 481 'selectors' => array( 482 '{{WRAPPER}} .welcome-section .icon-box .icon' => 'color: {{VALUE}}', 483 ), 484 ) 485 ); 486 $this->add_control( 487 'box_icon_bg_color', 488 array( 489 'label' => __('Box Icon BG Color', 'welbim'), 490 'separator' => 'before', 491 'type' => \Elementor\Controls_Manager::COLOR, 492 'selectors' => array( 493 '{{WRAPPER}} .welcome-section-two .experience-years' => 'background-color: {{VALUE}}', 494 '{{WRAPPER}} .welcome-section-three .experience-years' => 'background-color: {{VALUE}}', 495 ), 496 ) 497 ); 498 499 $this->add_control( 500 'box_icon_color', 501 array( 502 'label' => __('Box Icon Color', 'welbim'), 503 'separator' => 'before', 504 'type' => \Elementor\Controls_Manager::COLOR, 505 'selectors' => array( 506 '{{WRAPPER}} .welcome-section-two .experience-years .icon' => 'color: {{VALUE}}', 507 '{{WRAPPER}} .welcome-section-three .experience-years .icon' => 'color: {{VALUE}}', 508 ), 509 ) 510 ); 511 512 $this->add_control( 513 'box_title_color', 514 array( 515 'label' => __('Box Title Color', 'welbim'), 516 'separator' => 'before', 517 'type' => \Elementor\Controls_Manager::COLOR, 518 'selectors' => array( 519 '{{WRAPPER}} .welcome-section-two .experience-years h4' => 'color: {{VALUE}}', 520 '{{WRAPPER}} .welcome-section-three .experience-years h4' => 'color: {{VALUE}}', 521 ), 522 ) 523 ); 524 525 $this->add_control( 526 'button_bg_color', 527 array( 528 'label' => __('Button BG Color', 'welbim'), 529 'separator' => 'before', 530 'type' => \Elementor\Controls_Manager::COLOR, 531 'selectors' => array( 532 '{{WRAPPER}} .btn-style-one' => 'background-color: {{VALUE}}', 533 ), 534 ) 535 ); 536 537 $this->end_controls_section(); 538 } 539 540 protected function render() 541 { 542 $settings = $this->get_settings_for_display(); 543 $image_one = ($settings['image_one']['id'] != '') ? wp_get_attachment_image($settings['image_one']['id'], 'full') : $settings['image_one']['url']; 544 $image_one_alt = get_post_meta($settings['image_one']['id'], '_wp_attachment_image_alt', true); 545 $image_two = ($settings['image_two']['id'] != '') ? wp_get_attachment_image($settings['image_two']['id'], 'full') : $settings['image_two']['url']; 546 $image_two_alt = get_post_meta($settings['image_two']['id'], '_wp_attachment_image_alt', true); 547 $title = $settings['title']; 548 $sub_title = $settings['sub_title']; 549 $bottom_title = $settings['bottom_title']; 550 $background_img = ($settings['background_img']['id'] != '') ? wp_get_attachment_image($settings['background_img']['id'], 'full') : $settings['background_img']['url']; 551 $background_image_alt = get_post_meta($settings['background_img']['id'], '_wp_attachment_image_alt', true); 552 $description = $settings['description']; 553 $layout_style = $settings['layout_style']; 554 if ($layout_style == '1') { 555 ?> 556 <section class="welcome-section"> 557 <div class="background-image"> 558 <?php 559 if (wp_http_validate_url($background_img)) { 560 ?> 561 <img src="<?php echo esc_url($background_img); ?>" alt="<?php esc_url($background_image_alt); ?>"> 562 <?php 563 } else { 564 echo $background_img; 565 } 566 ?> 567 </div> 568 <div class="auto-container"> 569 <div class="row"> 570 <div class="col-lg-6"> 571 <div class="image-wrapper"> 572 <div class="image-one "> 573 <?php 574 if (wp_http_validate_url($image_one)) { 575 ?> 576 <img src="<?php echo esc_url($image_one); ?>" alt="<?php esc_url($image_one_alt); ?>"> 577 <?php 578 } else { 579 echo $image_one; 580 } 581 ?> 582 </div> 583 <div class="image-two" data-parallax='{"y": 100}'> 584 <?php 585 if (wp_http_validate_url($image_two)) { 586 ?> 587 <img src="<?php echo esc_url($image_two); ?>" alt="<?php esc_url($image_two_alt); ?>"> 588 <?php 589 } else { 590 echo $image_two; 591 } 592 ?> 593 </div> 594 </div> 595 </div> 596 <div class="col-lg-6"> 597 <div class="content-side"> 598 <div class="sec-title mb-10"> 599 <div class="sub-title"><?php echo $sub_title; ?></div> 600 <h2><?php echo $title; ?></h2> 601 </div> 602 <div class="text "><?php echo $description; ?></div> 603 <div class="row"> 604 <div class="col-md-6"> 605 <ul class="list "> 606 <?php 607 $i = 1; 608 foreach ($settings['items1'] as $item) { 609 $item_title = $item['item_title']; 610 ?> 611 <li><?php echo $item_title; ?></li> 612 <?php 613 $i++; 614 } 615 ?> 616 </ul> 617 </div> 618 <div class="col-md-6"> 619 <?php 620 $i = 1; 621 foreach ($settings['items2'] as $item) { 622 $item_title = $item['item_title2']; 623 ?> 624 <div class="icon-box "> 625 <div class="icon"><?php \Elementor\Icons_Manager::render_icon($item['icon'], array('aria-hidden' => 'true')); ?></div> 626 <h4><?php echo $item_title; ?></h4> 627 </div> 628 <?php 629 $i++; 630 } 631 ?> 632 </div> 633 </div> 634 <div class="note"><?php echo $bottom_title; ?></div> 635 </div> 636 </div> 637 </div> 638 </div> 639 </section> 640 <?php 641 } elseif ($layout_style == '2') { 642 $sub_title = $settings['sub_title']; 643 $title = $settings['title']; 644 $description = $settings['description']; 645 $right_title = $settings['right_title']; 646 $content1 = $settings['content1']; 647 $btn_title = $settings['btn_title']; 648 $btn_link = $settings['btn_link']; 649 $image_one = ($settings['image_one']['id'] != '') ? wp_get_attachment_image_url($settings['image_one']['id'], 'full') : $settings['image_one']['url']; 650 $image_one_alt = get_post_meta($settings['image_one']['id'], '_wp_attachment_image_alt', true); 651 $image_two = ($settings['image_two']['id'] != '') ? wp_get_attachment_image($settings['image_two']['id'], 'full') : $settings['image_two']['url']; 652 $image_two_alt = get_post_meta($settings['image_two']['id'], '_wp_attachment_image_alt', true); 653 ?> 654 <section class="welcome-section-two"> 655 <div class="side-image" style="background-image: url(<?php echo $image_one; ?>)"></div> 656 <div class="auto-container"> 657 <div class="row"> 658 <div class="col-lg-6"> 659 <div class="image-wrapper"> 660 <div class="image-one"> 661 <?php 662 if (wp_http_validate_url($image_two)) { 663 ?> 664 <img src="<?php echo esc_url($image_two); ?>" alt="<?php esc_url($image_two_alt); ?>"> 665 <?php 666 } else { 667 echo $image_two; 668 } 669 ?> 670 </div> 671 </div> 672 </div> 673 <div class="col-lg-6"> 674 <div class="content-side"> 675 <div class="sec-title mb-5"> 676 <div class="sub-title"><?php echo $sub_title; ?></div> 677 <h2 class="mb-30"><?php echo $title; ?></h2> 678 </div> 679 <div class="text "><?php echo $description; ?></div> 680 <div class="bottom-content"> 681 <div class="experience-years "> 682 <div class="icon"><?php \Elementor\Icons_Manager::render_icon($settings['icon'], array('aria-hidden' => 'true')); ?></div> 683 <h4><?php echo $right_title; ?></h4> 684 </div> 685 <div class="progress-levels"> 686 <!--Skill Box--> 687 <?php 688 $i = 1; 689 foreach ($settings['item_prog'] as $item) { 690 $item_title = $item['item_prog_title']; 691 $item_data = $item['item_prog_data']; 692 ?> 693 <div class="progress-box"> 694 <h5><?php echo $item_title; ?></h5> 695 <div class="inner"> 696 <div class="bar"> 697 <div class="bar-innner"> 698 <div class="bar-fill" data-percent="<?php echo $item_data; ?>"> 699 <div class="percent"></div> 700 </div> 701 </div> 702 </div> 703 </div> 704 </div> 705 <?php 706 $i++; 707 } 708 ?> 709 <!--Skill Box--> 710 </div> 711 <ul class="list "> 712 <?php echo $content1; ?> 713 </ul> 714 <div class="link"> 715 <a href="<?php echo $btn_link; ?>" class="theme-btn btn-style-one"><span><?php echo $btn_title; ?></span></a> 716 </div> 717 </div> 718 </div> 719 </div> 720 </div> 721 </div> 722 </section> 723 <?php 724 } elseif ($layout_style == '3') { 725 $sub_title = $settings['sub_title']; 726 $title = $settings['title']; 727 $description = $settings['description']; 728 $content1 = $settings['content1']; 729 $content2 = $settings['content2']; 730 $right_title = $settings['right_title']; 731 $image_one = ($settings['image_one']['id'] != '') ? wp_get_attachment_image($settings['image_one']['id'], 'full') : $settings['image_one']['url']; 732 $image_one_alt = get_post_meta($settings['image_one']['id'], '_wp_attachment_image_alt', true); 733 ?> 734 <section class="welcome-section-three"> 735 <div class="auto-container"> 736 <div class="row"> 737 <div class="col-lg-6"> 738 <div class="image-wrapper"> 739 <div class="image-one "> 740 <?php 741 if (wp_http_validate_url($image_one)) { 742 ?> 743 <img src="<?php echo esc_url($image_one); ?>" alt="<?php esc_url($image_one_alt); ?>"> 744 <?php 745 } else { 746 echo $image_one; 747 } 748 ?> 749 <div class="experience-years"> 750 <div class="icon"><?php \Elementor\Icons_Manager::render_icon($settings['icon'], array('aria-hidden' => 'true')); ?></div> 751 <h4><?php echo $right_title; ?></h4> 752 </div> 753 </div> 754 </div> 755 </div> 756 <div class="col-lg-6"> 757 <div class="content-side"> 758 <div class="sec-title mb-30"> 759 <div class="sub-title"><?php echo $sub_title; ?></div> 760 <h2><?php echo $title; ?></h2> 761 </div> 762 <div class="text mb-30"><?php echo $description; ?></div> 763 <div class="bottom-content"> 764 <div class="row"> 765 <div class="col-md-6"> 766 <ul class="list"> 767 <?php echo $content1; ?> 768 </ul> 769 </div> 770 <div class="col-md-6"> 771 <ul class="list"> 772 <?php echo $content2; ?> 773 </ul> 774 </div> 775 </div> 776 <div class="progress-levels"> 777 <!--Skill Box--> 778 <?php 779 $i = 1; 780 foreach ($settings['item_prog'] as $item) { 781 $item_title = $item['item_prog_title']; 782 $item_data = $item['item_prog_data']; 783 ?> 784 <div class="progress-box"> 785 <h5><?php echo $item_title; ?></h5> 786 <div class="inner"> 787 <div class="bar"> 788 <div class="bar-innner"> 789 <div class="bar-fill" data-percent="<?php echo $item_data; ?>"> 790 <div class="percent"></div> 791 </div> 792 </div> 793 </div> 794 </div> 795 </div> 796 <?php $i++; 797 } ?> 798 <!--Skill Box--> 799 </div> 800 </div> 801 </div> 802 </div> 803 </div> 804 </div> 805 </section> 806 <?php 807 } 808 } 809 }