File: /mnt/data/dreamsrent-wp-demo/wp-content/plugins/dreamsrent-widgets/widgets/class-team.php
<?php
namespace Dreamsrentelementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use \Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Elementor Hello World
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class DRS_team extends Widget_Base {
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'dreamsrent_elementor_teamnew';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'DR Team', 'dreamsrent_elementor' );
}
/**
* Retrieve the widget icon.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-lock-user';
}
/**
* Retrieve the list of categories the widget belongs to.
*
* Used to determine where to display the widget in the editor.
*
* Note that currently Elementor supports only one category.
* When multiple categories passed, Elementor uses the first one.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'dreamsrentelemetortheme' ];
}
/**
* Retrieve the list of scripts the widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget scripts dependencies.
*/
public function get_script_depends() {
return [ 'dreamsrentelementor-elementor' ];
}
/**
* Register the widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.0.0
*
* @access protected
*/
protected function register_controls() {
$this->start_controls_section(
'section_content',
[
'label' => __( 'Content', 'dreamsrent_elementor' ),
]
);
$this->add_control(
'testimonials',
[
'label' => __( 'Testimonial Items', 'dreamsrent_elementor' ),
'type' => Controls_Manager::REPEATER,
'default' => [
[
'name' => __( 'Matt Fierce', 'dreamsrent_elementor' ),
'desc' => __( 'CEO', 'dreamsrent_elementor' ),
'image' => [ 'url' => Utils::get_placeholder_image_src() ],
'class' => '',
],
[
'name' => __( 'May Daniel', 'dreamsrent_elementor' ),
'desc' => __( 'CEO', 'dreamsrent_elementor' ),
'image' => [ 'url' => Utils::get_placeholder_image_src() ],
'class' => '',
],
],
'fields' => [
[
'name' => 'name',
'label' => __( 'Name', 'dreamsrent_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Matt Fierce' , 'dreamsrent_elementor' ),
'dynamic' => [
'active' => true,
],
'label_block' => true,
],
[
'name' => 'desc',
'label' => __( 'Content', 'dreamsrent_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'CEO', 'dreamsrent_elementor' ),
'show_label' => false,
],
[
'name' => 'image',
'label' => __( 'Image', 'dreamsrent_elementor' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
'dynamic' => [
'active' => true,
],
'label_block' => true,
],
[
'name' => 'fb_link',
'label' => __( 'Facebook Link', 'dreamsrent_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( '#', 'dreamsrent_elementor' ),
'show_label' => true,
],
[
'name' => 'tw_link',
'label' => __( 'Twitter Link', 'dreamsrent_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( '#', 'dreamsrent_elementor' ),
'show_label' => true,
],
[
'name' => 'lin_link',
'label' => __( 'Linkdin Link', 'dreamsrent_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( '#', 'dreamsrent_elementor' ),
'show_label' => true,
],
[
'name' => 'class',
'label' => __( 'Class', 'dreamsrent_elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
],
],
'title_field' => '{{{ name }}}',
]
);
$this->add_control(
'class',
[
'label' => __( 'Class', 'dreamsrent_elementor' ),
'type' => Controls_Manager::TEXT,
]
);
$this->end_controls_section();
// Style tab: Name
$this->start_controls_section(
'team_name_style',
[
'label' => __( 'Name', 'dreamsrent_elementor' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'team_name_color',
[
'label' => __( 'Name Color', 'dreamsrent_elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .our-team .team-post-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'team_name_typography',
'label' => __( 'Name Typography', 'dreamsrent_elementor' ),
'selector' => '{{WRAPPER}} .our-team .team-post-title',
]
);
$this->end_controls_section();
// Style tab: Designation
$this->start_controls_section(
'team_designation_style',
[
'label' => __( 'Designation', 'dreamsrent_elementor' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'team_designation_color',
[
'label' => __( 'Designation Color', 'dreamsrent_elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .our-team .team-designation' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'team_designation_typography',
'label' => __( 'Designation Typography', 'dreamsrent_elementor' ),
'selector' => '{{WRAPPER}} .our-team .team-designation',
]
);
$this->end_controls_section();
}
/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
*
* @access protected
*/
protected function render() {
$settings = $this->get_settings();
?>
<div class="container">
<div class="row">
<?php foreach ( $settings['testimonials'] as $index => $item ) :
$image = $item['image']['url'];?>
<div class="col-lg-4 col-md-6 col-12" data-aos="fade-down" data-aos-duration="1200" data-aos-delay="100">
<div class="our-team">
<div class="profile-pic">
<img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $item['name'] ); ?>">
</div>
<div class="team-prof">
<h3 class="team-post-title"><?php echo $item['name']; ?></h3>
<span class="team-designation"><?php echo $item['desc']; ?></span>
<div class="footer-social-links m-0">
<ul class="nav">
<li>
<a href="<?php echo esc_url( $item['fb_link'] ); ?>"><i class="fa-brands fa-facebook-f fa-facebook fi-icon"></i></a>
</li>
<li>
<a href="<?php echo esc_url( $item['tw_link'] ); ?>"><i class="fab fa-twitter fi-icon"></i> </a>
</li>
<li>
<a href="<?php echo esc_url( $item['lin_link'] ); ?>"><i class="fab fa-linkedin fi-icon"></i></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php
}
/**
* Render the 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
}
}