<?php
/**
* Team Widget
*/
namespace Elementor;
class Cyarb_Team_Two extends Widget_Base{
public function get_name(){
return "Cyarb_TeamTwo";
}
public function get_title(){
return "Team Two";
}
public function get_icon(){
return "eicon-gallery-group";
}
public function get_categories(){
return ['cyarb-elements'];
}
protected function register_controls(){
$this->start_controls_section(
'Cyarb_Team',
[
'label' => __( 'Cyarb Team', 'cyarb-toolkit' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'cyarb-toolkit' ),
'type' => Controls_Manager::TEXTAREA,
]
);
$this->add_control(
'title_tag',
[
'label' => __( 'Title Tag', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => esc_html__( 'h1', 'cyarb-toolkit' ),
'h2' => esc_html__( 'h2', 'cyarb-toolkit' ),
'h3' => esc_html__( 'h3', 'cyarb-toolkit' ),
'h4' => esc_html__( 'h4', 'cyarb-toolkit' ),
'h5' => esc_html__( 'h5', 'cyarb-toolkit' ),
'h6' => esc_html__( 'h6', 'cyarb-toolkit' ),
],
'default' => 'h2',
]
);
$this->add_control(
'columns',
[
'label' => esc_html__( 'Choose Columns', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'options' => [
'1' => esc_html__( '1', 'cyarb-toolkit' ),
'2' => esc_html__( '2', 'cyarb-toolkit' ),
'3' => esc_html__( '3', 'cyarb-toolkit' ),
'4' => esc_html__( '4', 'cyarb-toolkit' ),
],
'default' => '3',
]
);
$this->add_control(
'show_social',
[
'label' => __( 'Show Social Link', 'cyarb-toolkit' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => __( 'Show', 'cyarb-toolkit' ),
'label_off' => __( 'Hide', 'cyarb-toolkit' ),
'return_value' => 'yes',
'default' => 'yes',
]
);
$repeater = new Repeater();
$repeater->add_control(
'member_img',
[
'label' => esc_html__( 'Image', 'cyarb-toolkit' ),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
]
);
$repeater->add_control(
'name',
[
'label' => esc_html__( 'Member Name', 'cyarb-toolkit' ),
'type' => Controls_Manager::TEXT,
]
);
$repeater->add_control(
'designation',
[
'label' => esc_html__( 'Designation', 'cyarb-toolkit' ),
'type' => Controls_Manager::TEXT,
]
);
$repeater->add_control(
'icon_type',
[
'label' => __( 'Icon Type', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => [
'1' =>__( 'LineIcons Font', 'cyarb-toolkit' ),
'2' => __('Font Awesome', 'cyarb-toolkit' ),
],
'default' => '1',
]
);
$repeater->add_control(
'lineicon1',
[
'label' => esc_html__( 'Icon Class 1', 'cyarb-toolkit' ),
'type' => Controls_Manager::TEXT,
'default' => 'lni lni-facebook-filled',
'condition' => [
'icon_type' => '1',
],
]
);
$repeater->add_control(
'icon1', [
'label' => __( 'Social Icon One', 'cyarb-toolkit' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fa fa-phone',
'library' => 'solid',
],
'condition' => [
'icon_type' => '2',
],
]
);
$repeater->add_control(
'url1',
[
'label' => esc_html__( 'Social Link One', 'cyarb-toolkit' ),
'type' => Controls_Manager::URL,
]
);
$repeater->add_control(
'lineicon2',
[
'label' => esc_html__( 'Icon Class 2', 'cyarb-toolkit' ),
'type' => Controls_Manager::TEXT,
'condition' => [
'icon_type' => '1',
],
]
);
$repeater->add_control(
'icon2',
[
'label' => esc_html__( 'Social Icon Two', 'cyarb-toolkit' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fa fa-phone',
'library' => 'solid',
],
'condition' => [
'icon_type' => '2',
],
]
);
$repeater->add_control(
'url2',
[
'label' => esc_html__( 'Social Link Two', 'cyarb-toolkit' ),
'type' => Controls_Manager::URL,
]
);
$repeater->add_control(
'lineicon3',
[
'label' => esc_html__( 'Icon Class 3', 'cyarb-toolkit' ),
'type' => Controls_Manager::TEXT,
'condition' => [
'icon_type' => '1',
],
]
);
$repeater->add_control(
'icon3',
[
'label' => esc_html__( 'Social Icon Three', 'cyarb-toolkit' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fa fa-phone',
'library' => 'solid',
],
'condition' => [
'icon_type' => '2',
],
]
);
$repeater->add_control(
'url3',
[
'label' => esc_html__( 'Social Link Three', 'cyarb-toolkit' ),
'type' => Controls_Manager::URL,
]
);
$repeater->add_control(
'lineicon4',
[
'label' => esc_html__( 'Icon Class 4', 'cyarb-toolkit' ),
'type' => Controls_Manager::TEXT,
'condition' => [
'icon_type' => '1',
],
]
);
$repeater->add_control(
'icon4',
[
'label' => esc_html__( 'Social Icon Four', 'cyarb-toolkit' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fa fa-phone',
'library' => 'solid',
],
'condition' => [
'icon_type' => '2',
],
]
);
$repeater->add_control(
'url4',
[
'label' => esc_html__( 'Social Link Four', 'cyarb-toolkit' ),
'type' => Controls_Manager::URL,
]
);
$this->add_control(
'teams',
[
'label' => esc_html__( 'Add Member', 'cyarb-toolkit' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
]
);
$this-> end_controls_section();
// Start Style content controls
$this-> start_controls_section(
'style',
[
'label' => esc_html__('Style', 'cyarb-toolkit'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .section-title h1, .section-title h2, .section-title h3, .section-title h4, .section-title h5, .section-title h6' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => __( 'Title Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .section-title h1, .section-title h2, .section-title h3, .section-title h4, .section-title h5, .section-title h6',
]
);
$this->add_control(
'name_color',
[
'label' => esc_html__( 'Member Name Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .content h3' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'name_typography',
'label' => __( 'Name Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .single-team-card .content h3',
]
);
$this->add_control(
'designation_color',
[
'label' => esc_html__( 'Member Designation Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .content span' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'designation_typography',
'label' => __( 'Designation Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .single-team-card .content span',
]
);
$this->add_control(
'card_icon_color',
[
'label' => esc_html__( 'Card Icon Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .content .icon i' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'card_icon_bgcolor',
[
'label' => esc_html__( 'Card Icon Background Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .content .icon i' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'card_icon_hcolor',
[
'label' => esc_html__( 'Card Icon Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card:hover .content .icon i' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'card_icon_bghcolor',
[
'label' => esc_html__( 'Card Icon Background Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card:hover .content .icon i' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'social_icon_color',
[
'label' => esc_html__( 'Social Icon Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .team-image .social-links li a' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'so_icon_bgcolor',
[
'label' => esc_html__( 'Social Icon Background Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .team-image .social-links li a' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'so_icon_hcolor',
[
'label' => esc_html__( 'Social Icon Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .team-image .social-links li a:hover' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'so_icon_bghcolor',
[
'label' => esc_html__( 'Social Icon Background Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-team-card .team-image .social-links li a:hover' => 'background-color: {{VALUE}}',
],
]
);
$this-> end_controls_section();
}
protected function render()
{
$settings = $this->get_settings_for_display();
$slider = $settings['teams'];
// Card Columns
$columns = $settings['columns'];
if ($columns == '1') {
$column = 'col-lg-12 col-md-6';
}elseif ($columns == '2') {
$column = 'col-lg-6 col-md-6';
}elseif ($columns == '3') {
$column = 'col-lg-4 col-md-6 col-sm-6';
}elseif ($columns == '4') {
$column = 'col-lg-3 col-md-6 col-sm-6';
}
?>
<div class="team-style-two-area pb-75">
<div class="container">
<?php if( $settings['title'] != '' ) : ?>
<div class="section-title">
<<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
</div>
<?php endif; ?>
<div class="row justify-content-center">
<?php foreach( $settings['teams'] as $item ): ?>
<div class="<?php echo esc_attr( $column );?>">
<div class="single-team-card">
<div class="team-image">
<?php if( $item['member_img']['url'] != '' ) : ?>
<img src="<?php echo esc_url( $item['member_img']['url'] ); ?>" alt="<?php echo esc_attr( $item['name'] ); ?>">
<?php endif; ?>
<?php if( $settings['show_social'] == 'yes' ) : ?>
<ul class="social-links">
<?php if( $item['icon1'] != '' || $item['lineicon1']!='' ): ?>
<li>
<a target="_blank" href="<?php echo esc_url( $item['url1']['url'] ); ?>">
<?php if( $item['icon_type'] == 1 ){ ?>
<i class="<?php echo esc_attr($item['lineicon1']);?>"></i>
<?php } else {
\Elementor\Icons_Manager::render_icon( $item['icon1'], [ 'aria-hidden' => 'true' ] );
} ?>
</a>
</li>
<?php endif; ?>
<?php if( $item['icon2'] != '' || $item['lineicon2']!='' ): ?>
<li>
<a target="_blank" href="<?php echo esc_url( $item['url2']['url'] ); ?>">
<?php if( $item['icon_type'] == 1 ){ ?>
<i class="<?php echo esc_attr($item['lineicon2']);?>"></i>
<?php } else {
\Elementor\Icons_Manager::render_icon( $item['icon2'], [ 'aria-hidden' => 'true' ] );
} ?>
</a>
</li>
<?php endif; ?>
<?php if( $item['icon3'] != '' || $item['lineicon3']!='' ): ?>
<li>
<a target="_blank" href="<?php echo esc_url( $item['url3']['url'] ); ?>">
<?php if( $item['icon_type'] == 1 ){ ?>
<i class="<?php echo esc_attr($item['lineicon3']);?>"></i>
<?php } else {
\Elementor\Icons_Manager::render_icon( $item['icon3'], [ 'aria-hidden' => 'true' ] );
} ?>
</a>
</li>
<?php endif; ?>
<?php if( $item['icon4'] != '' || $item['lineicon4']!='' ): ?>
<li>
<a target="_blank" href="<?php echo esc_url( $item['url4']['url'] ); ?>">
<?php if( $item['icon_type'] == 1 ){ ?>
<i class="<?php echo esc_attr($item['lineicon4']);?>"></i>
<?php } else {
\Elementor\Icons_Manager::render_icon( $item['icon4'], [ 'aria-hidden' => 'true' ] );
} ?>
</a>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>
<div class="content">
<h3><?php echo esc_html( $item['name'] ); ?></h3>
<span><?php echo esc_html( $item['designation'] ); ?></span>
<div class="icon">
<i class='lni lni-chevron-right'></i>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Cyarb_Team_Two );