Sindbad~EG File Manager
<?php
if (!defined('ABSPATH')) {
exit;
}
class Elementor_Realpro_Team extends \Elementor\Widget_Base {
public function get_name() {
return 'realpro-team';
}
public function get_title() {
return esc_html__('Realpro: Our Team', 'realpro');
}
public function get_icon() {
return 'eicon-person';
}
public function get_categories() {
return ['realpro'];
}
public function get_base() {
return basename(__FILE__, '.php');
}
protected function register_controls() {
$this->start_controls_section(
'content',
[
'label' => esc_html__('Teams', 'realpro')
]
);
$this->add_control(
'columns',
[
'label' => esc_html__( 'Columns', 'realpro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
),
'default' => '3',
'selectors' => [
'{{WRAPPER}}' => '--our-teams-column: {{VALUE}};',
],
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'member_image',
array(
'label' => esc_html__( 'Choose Member Image', 'realpro' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => array(
'url' => \Elementor\Utils::get_placeholder_image_src(),
'id' => - 1,
),
)
);
$repeater->add_control(
'member_name',
array(
'label' => esc_html__( 'Member Name', 'realpro' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'Jane Doe', 'realpro' ),
'placeholder' => esc_html__( 'Member Name', 'realpro' ),
)
);
$repeater->add_control(
'member_position',
array(
'label' => esc_html__( 'Member Position', 'realpro' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'default' => esc_html__( 'Designer', 'realpro' ),
'placeholder' => esc_html__( 'Member Position', 'realpro' ),
)
);
$repeater->add_control(
'icon_data',
array(
'label' => esc_html__( 'Icon Data', 'realpro' ),
'label_block' => true,
'type' => \Elementor\Controls_Manager::SELECT2,
'default' => '',
'multiple' => true,
'options' => array(
'linkedin' => esc_html__( 'Linkedin', 'realpro' ),
'twitter' => esc_html__( 'Twitter', 'realpro' ),
),
)
);
$repeater->add_control(
'linkedin_link',
array(
'label' => esc_html__( 'Linkedin Link', 'realpro' ),
'type' => \Elementor\Controls_Manager::URL,
'placeholder' => esc_html__( 'https://your-link.com', 'realpro' ),
'show_external' => false,
'default' => array(
'url' => '',
'is_external' => true,
'nofollow' => true,
),
'condition' => array(
'icon_data' => 'linkedin',
),
)
);
$repeater->add_control(
'twitter_link',
array(
'label' => esc_html__( 'Twitter Link', 'realpro' ),
'type' => \Elementor\Controls_Manager::URL,
'placeholder' => esc_html__( 'https://your-link.com', 'realpro' ),
'show_external' => false,
'default' => array(
'url' => '',
'is_external' => true,
'nofollow' => true,
),
'condition' => array(
'icon_data' => 'twitter',
),
)
);
$this->add_control(
'repeater',
array(
'label' => esc_html__( 'List Member', 'realpro' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => array(
array(
'member_name' => esc_html__( 'Jane Doe', 'realpro' ),
),
array(
'member_name' => esc_html__( 'Stevan kate', 'realpro' ),
),
array(
'member_name' => esc_html__( 'Hander Ronay', 'realpro' ),
),
),
'title_field' => '{{{ member_name }}}',
)
);
$this->end_controls_section();
}
public function render() {
$settings = $this->get_settings_for_display();
$repeaters = $settings['repeater'];
?>
<div class="realpro-team-section">
<?php
if ( ! empty( $repeaters ) ) {
foreach ( $repeaters as $item ) {
if( isset($item['icon_data']) && $item['icon_data']){
$class = ' has_social';
}else{
$class = '';
}
?>
<div class="realpro-team-list">
<div class="realpro-team-list-item">
<?php $this->render_thumbnail( $settings, $item ); ?>
<div class="realpro-content<?php echo esc_attr($class); ?>">
<?php
$this->render_member_name( $settings, $item );
$this->render_member_position( $settings, $item );
$this->render_member_social($item);
?>
</div>
</div>
</div>
<?php
}
}
?>
</div>
<?php
}
protected function render_thumbnail( $settings, $item ) {
$settings['thumbnail_id'] = $item['member_image'];
$thumbnail_html = \Elementor\Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail_size',
'thumbnail_id' );
if ( empty( $thumbnail_html ) ) {
return;
}
?>
<div class="realpro-team__thumbnail">
<div class="realpro-team__image">
<?php
echo wp_kses_post( $thumbnail_html );
?>
</div>
</div>
<?php
}
protected function render_member_name( $settings, $item ) {
$op_tag = '<h4 class="realpro-team__member-name">';
$cl_tag = '</h4>';
if ( ! empty( $item['member_name'] ) ) {
echo wp_kses_post( $op_tag );
echo esc_html( $item['member_name'] );
echo wp_kses_post( $cl_tag );
}
}
protected function render_member_position( $settings, $item ) {
if ( ! empty( $item['member_position'] ) ) {
?>
<div class="realpro-team__member-position">
<?php
echo wpautop( $item['member_position'] ); ?>
</div>
<?php
}
}
protected function render_member_social( $item ) {
$list_social = $item['icon_data'];
$icons = array(
'linkedin' => 'rp-linke',
'twitter' => 'rp-twit',
);
if($list_social) {
?>
<div class="realpro-team__list-social">
<?php
foreach ( $list_social as $key_list => $value ) {
?>
<a href="<?php echo esc_attr($item[ $value . '_link' ]['url']); ?>">
<i class="<?php echo esc_attr( $icons[ $value ] ); ?>" aria-hidden="true"></i>
</a>
<?php
}
?>
</div>
<?php
}
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists