balmet.com

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

Our_Team.php (7511B)


      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 use Elementor\Group_Control_Typography;
      9 
     10 class Our_Team extends Widget_Base
     11 {
     12 	public function get_name()
     13 	{
     14 		return 'our_team';
     15 	}
     16 
     17 	public function get_title()
     18 	{
     19 		return esc_html__('Welbim Team', 'welbim');
     20 	}
     21 
     22 	public function get_icon()
     23 	{
     24 		return 'sds-widget-ico';
     25 	}
     26 
     27 	public function get_categories()
     28 	{
     29 		return ['Welbim'];
     30 	}
     31 
     32 	protected function _register_controls()
     33 	{
     34 
     35 		$this->start_controls_section(
     36 			'layout',
     37 			[
     38 				'label' => __('Layout Style', 'welbim'),
     39 				'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
     40 			]
     41 		);
     42 
     43 		$this->add_control(
     44 			'layout_style',
     45 			[
     46 				'label'   => __('Layout', 'welbim'),
     47 				'type'    => \Elementor\Controls_Manager::SELECT,
     48 				'default' => '1',
     49 				'options' => [
     50 					'1' => __('One', 'welbim'),
     51 					'2' => __('Two', 'welbim'),
     52 				],
     53 			]
     54 		);
     55 
     56 		$this->end_controls_section();
     57 
     58 		$this->start_controls_section(
     59 			'general',
     60 			[
     61 				'label' => esc_html__('General', 'welbim'),
     62 			]
     63 		);
     64 
     65 		$this->add_control(
     66 			'sub_title',
     67 			[
     68 				'label'   => esc_html__('Sub Title', 'welbim'),
     69 				'type'    => Controls_Manager::TEXT,
     70 				'default' => __('Our Services', 'welbim'),
     71 			]
     72 		);
     73 
     74 		$this->add_control(
     75 			'heading',
     76 			[
     77 				'label'   => esc_html__('Heading', 'welbim'),
     78 				'type'    => Controls_Manager::TEXT,
     79 				'default' => __('What we offer', 'welbim'),
     80 			]
     81 		);
     82 
     83 		$this->add_group_control(
     84 			\Elementor\Group_Control_Background::get_type(),
     85 			[
     86 				'name'     => 'background',
     87 				'label'    => __('Background', 'plugin-domain'),
     88 				'types'    => ['classic', 'gradient', 'video'],
     89 				'selector' => '{{WRAPPER}} .services-section.style-two:before',
     90 			]
     91 		);
     92 
     93 		$this->end_controls_section();
     94 
     95 		$this->start_controls_section(
     96 			'item',
     97 			[
     98 				'label' => esc_html__('item', 'welbim'),
     99 			]
    100 		);
    101 
    102 		$repeater = new Repeater();
    103 
    104 		$repeater->add_control(
    105 			'item_title',
    106 			[
    107 				'label'   => esc_html__('Name', 'welbim'),
    108 				'type'    => Controls_Manager::TEXT,
    109 				'default' => __('STEEL WELDING', 'welbim'),
    110 			]
    111 		);
    112 
    113 		$repeater->add_control(
    114 			'item_designation',
    115 			[
    116 				'label'   => esc_html__('Designation', 'welbim'),
    117 				'type'    => Controls_Manager::TEXT,
    118 				'default' => __('Co Founder', 'welbim'),
    119 			]
    120 		);
    121 
    122 		$repeater->add_control(
    123 			'item_image',
    124 			[
    125 				'label'   => esc_html__('Image', 'welbim'),
    126 				'type'    => Controls_Manager::MEDIA,
    127 				'default' => [
    128 					'url' => Utils::get_placeholder_image_src(),
    129 				],
    130 			]
    131 		);
    132 
    133 		$repeater->add_control(
    134 			'item_title_link',
    135 			[
    136 				'label'         => esc_html__('Title Link', 'welbim'),
    137 				'type'          => Controls_Manager::URL,
    138 				'placeholder'   => esc_html__('https://your-link.com', 'welbim'),
    139 				'show_external' => true,
    140 				'default'       => [
    141 					'url'         => '',
    142 					'is_external' => false,
    143 					'nofollow'    => false,
    144 				],
    145 			]
    146 		);
    147 
    148 		$repeater->add_control(
    149 			'item_social',
    150 			[
    151 				'label'   => esc_html__('Social', 'welbim'),
    152 				'type'    => Controls_Manager::TEXTAREA,
    153 			]
    154 		);
    155 
    156 		$this->add_control(
    157 			'items',
    158 			[
    159 				'label'   => esc_html__('Repeater List', 'welbim'),
    160 				'type'    => Controls_Manager::REPEATER,
    161 				'fields'  => $repeater->get_controls(),
    162 				'default' => [
    163 					[
    164 						'list_title'   => esc_html__('Title #1', 'welbim'),
    165 						'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'),
    166 					],
    167 					[
    168 						'list_title'   => esc_html__('Title #2', 'welbim'),
    169 						'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim'),
    170 					],
    171 				],
    172 			]
    173 		);
    174 
    175 		$this->end_controls_section();
    176 
    177 		//Typography section
    178 		$this->start_controls_section(
    179 			'typography_section',
    180 			array(
    181 				'label' => __( 'Typography Section', 'welbim' ),
    182 				'tab'   => Controls_Manager::TAB_STYLE,
    183 			)
    184 		);
    185 	
    186 		$this->add_group_control(
    187 			Group_Control_Typography::get_type(),
    188 			array(
    189 				'name'     => 'subtitle_typography',
    190 				'label'    => __( 'Sub Title', 'welbim' ),
    191 				'selector' => '{{WRAPPER}} .sec-title .sub-title',
    192 	
    193 			)
    194 		);
    195 		
    196 		$this->add_group_control(
    197 			Group_Control_Typography::get_type(),
    198 			array(
    199 				'name'     => 'heading_typography',   
    200 				'label'    => __( 'Heading', 'welbim' ),
    201 				'selector' => '{{WRAPPER}} .sec-title h2',
    202 	
    203 			)
    204 		);
    205 
    206 		$this->add_group_control(
    207 			Group_Control_Typography::get_type(),
    208 			array(
    209 				'name'     => 'name_typography',   
    210 				'label'    => __( 'Name', 'welbim' ),
    211 				'selector' => '{{WRAPPER}} .team-block h4',
    212 	
    213 			)
    214 		);
    215 	
    216 	$this->end_controls_section();
    217 
    218 	//Color Section
    219 
    220 	$this->start_controls_section(
    221 		'color_section',
    222 		array(
    223 			'label' => __('Color Section', 'welbim'),
    224 			'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
    225 		)
    226 	);
    227 		$this->add_control(
    228 			'subtitle_color',
    229 			array(
    230 				'label'     => __('Sub Title Color', 'welbim'),
    231 				'separator' => 'before',
    232 				'type'      => \Elementor\Controls_Manager::COLOR,
    233 				'selectors' => array(
    234 					'{{WRAPPER}} .sec-title .sub-title' => 'color: {{VALUE}}',
    235 				),
    236 			)
    237 		);
    238 
    239 		$this->add_control(
    240 			'heading_color',
    241 			array(
    242 				'label'     => __('Heading Color', 'welbim'),
    243 				'separator' => 'before',
    244 				'type'      => \Elementor\Controls_Manager::COLOR,
    245 				'selectors' => array(
    246 					'{{WRAPPER}} .sec-title h2' => 'color: {{VALUE}}',
    247 				),
    248 			)
    249 		);
    250 
    251 		$this->add_control(
    252 			'name_color',
    253 			array(
    254 				'label'     => __('Name Color', 'welbim'),
    255 				'separator' => 'before',
    256 				'type'      => \Elementor\Controls_Manager::COLOR,
    257 				'selectors' => array(
    258 					'{{WRAPPER}} .team-block h4' => 'color: {{VALUE}}',
    259 				),
    260 			)
    261 		);
    262 
    263 
    264 	$this->end_controls_section();
    265 	}
    266 	protected function render()
    267 	{
    268 		$settings = $this->get_settings_for_display();
    269 		$layout   = $settings["layout_style"];
    270 		if ($layout == '1') {
    271 			$sub_title = $settings["sub_title"];
    272 			$heading   = $settings["heading"];
    273 ?>
    274 			<section class="team-section">
    275 				<div class="auto-container">
    276 					<div class="sec-title text-center">
    277 						<div class="sub-title"><?php echo $sub_title; ?></div>
    278 						<h2><?php echo $heading; ?></h2>
    279 					</div>
    280 					<div class="row">
    281 						<?php
    282 						$i = 1;
    283 						foreach ($settings["items"] as $item) {
    284 							$item_title       = $item["item_title"];
    285 							$item_designation = $item["item_designation"];
    286 							$item_social      = $item["item_social"];
    287 							$item_image       = ($item["item_image"]["id"] != "") ? wp_get_attachment_image_url($item["item_image"]["id"], "full") : $item["item_image"]["url"];
    288 							$item_image_alt   = get_post_meta($item["item_image"]["id"], "_wp_attachment_image_alt", true);
    289 						?>
    290 							<div class="col-lg-4 col-md-6 team-block">
    291 								<div class="inner-box ">
    292 									<div class="image">
    293 										<?php
    294 										if (wp_http_validate_url($item_image)) {
    295 										?>
    296 											<img src="<?php echo esc_url($item_image); ?>" alt="<?php esc_url($item_image_alt); ?>">
    297 										<?php
    298 										} else {
    299 											echo $item_image;
    300 										}
    301 										?>
    302 									</div>
    303 									<div class="content">
    304 										<h4><?php echo $item_title; ?></h4>
    305 										<div class="designation"><?php echo $item_designation; ?></div>
    306 										<ul class="social-icon">
    307 											<?php echo $item_social; ?>
    308 										</ul>
    309 									</div>
    310 								</div>
    311 							</div>
    312 						<?php
    313 							$i++;
    314 						}
    315 						?>
    316 					</div>
    317 				</div>
    318 			</section>
    319 <?php
    320 		}
    321 	}
    322 }