balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

Welbim_Clients.php (2678B)


      1 <?php
      2 namespace Welbim\Helper\Elementor\Widgets;
      3 use Elementor\Utils;
      4 use Elementor\Controls_Manager;
      5 use Elementor\Widget_Base;
      6 use Elementor\Plugin;
      7 use \Elementor\Repeater;
      8 
      9 class Welbim_Clients extends Widget_Base
     10 {
     11 	public function get_name()
     12 	{
     13 		return 'welbim_clients';
     14 	}
     15 
     16 	public function get_title()
     17 	{
     18 		return esc_html__('Welbim Clients', 'welbim-core');
     19 	}
     20 
     21 	public function get_icon()
     22 	{
     23 		return 'sds-widget-ico';
     24 	}
     25 
     26 	public function get_categories()
     27 	{
     28 		return ['Welbim'];
     29 	}
     30 
     31 	protected function _register_controls()
     32 	{
     33 		$this->start_controls_section(
     34 			'item',
     35 			[
     36 				'label' => esc_html__('item', 'welbim-core'),
     37 			]
     38 		);
     39 
     40 		$repeater = new Repeater();
     41 
     42 		$repeater->add_control(
     43 			'item_image',
     44 			[
     45 				'label' => esc_html__('Image', 'welbim-core'),
     46 				'type' => Controls_Manager::MEDIA,
     47 				'default' => [
     48 					'url' => Utils::get_placeholder_image_src(),
     49 				],
     50 			]
     51 		);
     52 
     53 		$this->add_control(
     54 			'items',
     55 			[
     56 				'label' => esc_html__('Repeater List', 'welbim-core'),
     57 				'type' => Controls_Manager::REPEATER,
     58 				'fields' => $repeater->get_controls(),
     59 				'default' => [
     60 					[
     61 						'list_title' => esc_html__('Title #1', 'welbim-core'),
     62 						'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim-core'),
     63 					],
     64 				],
     65 			]
     66 		);
     67 
     68 		$this->end_controls_section();
     69 	}
     70 	protected function render()
     71 	{
     72 		$settings =  $this->get_settings_for_display();
     73 ?>
     74 		<!-- Clients Logo Section -->
     75 		<section class="clients-logo-section">
     76 			<div class="auto-container">
     77 				<!--Sponsors Carousel-->
     78 				<div class="theme_carousel owl-theme owl-carousel" data-options='{"loop": true, "margin": 40, "autoheight":true, "lazyload":true, "nav": true, "dots": true, "autoplay": true, "autoplayTimeout": 6000, "smartSpeed": 300, "responsive":{ "0" :{ "items": "1" }, "600" :{ "items" : "2" }, "768" :{ "items" : "3" } , "992":{ "items" : "4" }, "1200":{ "items" : "5" }}}'>
     79 					<?php
     80 					$i = 1;
     81 					foreach ($settings["items"] as $item) {
     82 
     83 						$item_image = ($item["item_image"]["id"] != "") ? wp_get_attachment_image($item["item_image"]["id"], "full") : $item["item_image"]["url"];
     84 						$item_image_alt = get_post_meta($item["item_image"]["id"], "_wp_attachment_image_alt", true);
     85 					?>
     86 						<div class="slide-item">
     87 							<div class="image">
     88 								<?php
     89 								if (wp_http_validate_url($item_image)) {
     90 								?>
     91 									<img src="<?php echo esc_url($item_image); ?>" alt="<?php esc_url($item_image_alt); ?>">
     92 								<?php
     93 								} else {
     94 									echo $item_image;
     95 								}
     96 								?>
     97 							</div>
     98 						</div>
     99 					<?php
    100 						$i++;
    101 					}
    102 					?>
    103 				</div>
    104 			</div>
    105 		</section>
    106 <?php
    107 	}
    108 }