File: /home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/team.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Lesya Team Widget.
*
* @since 1.0
*/
class Lesya_Team_Widget extends Widget_Base {
public function get_name() {
return 'lesya-team';
}
public function get_title() {
return esc_html__( 'Team', 'lesya-plugin' );
}
public function get_icon() {
return 'eicon-parallax';
}
public function get_categories() {
return [ 'lesya-category' ];
}
/**
* Register widget controls.
*
* @since 1.0
*/
protected function register_controls() {
$this->start_controls_section(
'heading_tab',
[
'label' => esc_html__( 'Heading', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title',
[
'label' => esc_html__( 'Title', 'lesya-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
'default' => esc_html__( 'Title', 'lesya-plugin' ),
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'subtitle',
[
'label' => esc_html__( 'Subtitle', 'lesya-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter subtitle', 'lesya-plugin' ),
'default' => esc_html__( 'Subtitle', 'lesya-plugin' ),
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'bg_text',
[
'label' => esc_html__( 'Background Title', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
'default' => esc_html__( 'Title', 'lesya-plugin' ),
]
);
$this->end_controls_section();
$this->start_controls_section(
'items_tab',
[
'label' => esc_html__( 'Items', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'image', [
'label' => esc_html__( 'Image', 'lesya-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'name', [
'label' => esc_html__( 'Name', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter name', 'lesya-plugin' ),
'default' => esc_html__( 'Enter name', 'lesya-plugin' ),
]
);
$repeater->add_control(
'role', [
'label' => esc_html__( 'Role', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter role', 'lesya-plugin' ),
'default' => esc_html__( 'Enter role', 'lesya-plugin' ),
]
);
$repeater->add_control(
'social', [
'label' => esc_html__( 'Show Social', 'lesya-plugin' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => __( 'Show', 'lesya-plugin' ),
'label_off' => __( 'Hide', 'lesya-plugin' ),
'return_value' => 'yes',
'default' => 'no',
]
);
$repeater->add_control(
'link1_label', [
'label' => esc_html__( 'Link #1 (Label)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter label', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link1_icon', [
'label' => esc_html__( 'Link #1 (Icon)', 'lesya-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link1_url', [
'label' => esc_html__( 'Link #1 (URL)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter URL', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link2_label', [
'label' => esc_html__( 'Link #2 (Label)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter label', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link2_icon', [
'label' => esc_html__( 'Link #2 (Icon)', 'lesya-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link2_url', [
'label' => esc_html__( 'Link #2 (URL)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter URL', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link3_label', [
'label' => esc_html__( 'Link #3 (Label)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter label', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link3_icon', [
'label' => esc_html__( 'Link #3 (Icon)', 'lesya-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link3_url', [
'label' => esc_html__( 'Link #3 (URL)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter URL', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link4_label', [
'label' => esc_html__( 'Link #4 (Label)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter label', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link4_icon', [
'label' => esc_html__( 'Link #4 (Icon)', 'lesya-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link4_url', [
'label' => esc_html__( 'Link #4 (URL)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter URL', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link5_label', [
'label' => esc_html__( 'Link #5 (Label)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter label', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link5_icon', [
'label' => esc_html__( 'Link #5 (Icon)', 'lesya-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
'condition' => [
'social' => 'yes'
],
]
);
$repeater->add_control(
'link5_url', [
'label' => esc_html__( 'Link #5 (URL)', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter URL', 'lesya-plugin' ),
'default' => '',
'condition' => [
'social' => 'yes'
],
]
);
$this->add_control(
'items',
[
'label' => esc_html__( 'Items', 'lesya-plugin' ),
'type' => Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ name }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'heading_styling',
[
'label' => esc_html__( 'Heading', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .section-title h2' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Title Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .section-title h2',
]
);
$this->add_control(
'subtitle_color',
[
'label' => esc_html__( 'Subtitle Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .section-title .sub-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'subtitle_typography',
'label' => esc_html__( 'Subtitle Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .section-title .sub-title',
]
);
$this->add_control(
'bgtext_color',
[
'label' => esc_html__( 'BG Text Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .section-title .bg-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'bgtext_typography',
'label' => esc_html__( 'BG Text Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .section-title .bg-text',
]
);
$this->end_controls_section();
$this->start_controls_section(
'items_styling',
[
'label' => esc_html__( 'Items', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'item_name_color',
[
'label' => esc_html__( 'Name Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .team-member h5' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_name_typography',
'label' => esc_html__( 'Name Typography:', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .team-member h5',
]
);
$this->add_control(
'item_role_color',
[
'label' => esc_html__( 'Role Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .team-member .designations' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_role_typography',
'label' => esc_html__( 'Role Typography:', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .team-member .designations',
]
);
$this->add_control(
'item_social_color',
[
'label' => esc_html__( 'Social Links Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .team-member .social-style-three a' => 'color: {{VALUE}};',
'{{WRAPPER}} .team-member .social-style-three a svg' => 'fill: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
$this->add_inline_editing_attributes( 'title', 'basic' );
$this->add_inline_editing_attributes( 'subtitle', 'basic' );
$this->add_inline_editing_attributes( 'bg_text', 'none' );
?>
<!-- Team Section Start -->
<section class="team-section text-center pt-140 rpt-90 pb-90 rpb-40">
<div class="container">
<?php if ( $settings['bg_text'] || $settings['subtitle'] || $settings['title'] ) : ?>
<div class="row justify-content-center">
<div class="col-xl-6 col-lg-7 col-md-9 col-sm-11">
<div class="section-title mb-65">
<?php if ( $settings['bg_text'] ) : ?>
<span class="bg-text">
<span <?php echo $this->get_render_attribute_string( 'bg_text' ); ?>>
<?php echo wp_kses_post( $settings['bg_text'] ); ?>
</span>
</span>
<?php endif; ?>
<?php if ( $settings['subtitle'] ) : ?>
<span class="sub-title">
<span <?php echo $this->get_render_attribute_string( 'subtitle' ); ?>>
<?php echo wp_kses_post( $settings['subtitle'] ); ?>
</span>
</span>
<?php endif; ?>
<?php if ( $settings['title'] ) : ?>
<h2>
<span <?php echo $this->get_render_attribute_string( 'title' ); ?>>
<?php echo wp_kses_post( $settings['title'] ); ?>
</span>
</h2>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if ( $settings['items'] ) : ?>
<div class="row justify-content-center">
<?php foreach ( $settings['items'] as $index => $item ) :
$item_name = $this->get_repeater_setting_key( 'name', 'items', $index );
$this->add_inline_editing_attributes( $item_name, 'basic' );
$item_role = $this->get_repeater_setting_key( 'role', 'items', $index );
$this->add_inline_editing_attributes( $item_role, 'basic' );
?>
<div class="col-lg-4 col-sm-6">
<div class="team-member wow fadeInUp delay-0-2s">
<?php if ( $item['image'] ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'lesya_900xAuto' ); ?>
<img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $item['name'] ); ?>" />
<?php endif; ?>
<?php if ( $item['name'] || $item['role'] ) : ?>
<div class="member-description">
<?php if ( $item['name'] ) : ?>
<h5>
<span <?php echo $this->get_render_attribute_string( $item_name ); ?>>
<?php echo wp_kses_post( $item['name'] ); ?>
</span>
</h5>
<?php endif; ?>
<?php if ( $item['role'] ) : ?>
<span class="designations">
<span <?php echo $this->get_render_attribute_string( $item_role ); ?>>
<?php echo wp_kses_post( $item['role'] ); ?>
</span>
</span>
<?php endif; ?>
<?php if ( $item['social'] == 'yes' ) : ?>
<div class="social-style-three">
<?php if ( $item['link1_url'] ) : ?>
<a href="<?php echo esc_attr( $item['link1_url'] ); ?>" title="<?php echo esc_attr( $item['link1_label'] ); ?>">
<?php \Elementor\Icons_Manager::render_icon( $item['link1_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</a>
<?php endif; ?>
<?php if ( $item['link2_url'] ) : ?>
<a href="<?php echo esc_attr( $item['link2_url'] ); ?>" title="<?php echo esc_attr( $item['link2_label'] ); ?>">
<?php \Elementor\Icons_Manager::render_icon( $item['link2_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</a>
<?php endif; ?>
<?php if ( $item['link3_url'] ) : ?>
<a href="<?php echo esc_attr( $item['link3_url'] ); ?>" title="<?php echo esc_attr( $item['link3_label'] ); ?>">
<?php \Elementor\Icons_Manager::render_icon( $item['link3_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</a>
<?php endif; ?>
<?php if ( $item['link4_url'] ) : ?>
<a href="<?php echo esc_attr( $item['link4_url'] ); ?>" title="<?php echo esc_attr( $item['link4_label'] ); ?>">
<?php \Elementor\Icons_Manager::render_icon( $item['link4_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</a>
<?php endif; ?>
<?php if ( $item['link5_url'] ) : ?>
<a href="<?php echo esc_attr( $item['link5_url'] ); ?>" title="<?php echo esc_attr( $item['link5_label'] ); ?>">
<?php \Elementor\Icons_Manager::render_icon( $item['link5_icon'], [ 'aria-hidden' => 'true' ] ); ?>
</a>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</section>
<!-- Team Section End -->
<?php
}
/**
* Render widget output in the editor.
*
* Written as a Backbone JavaScript template and used to generate the live preview.
*
* @since 1.0.0
* @access protected
*/
/*protected function content_template() { ?>
<?php }*/
}
Plugin::instance()->widgets_manager->register_widget_type( new Lesya_Team_Widget() );