HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/dreamsrent-wp/wp-content/plugins/dreamsrent-widgets/widgets/class-whychoose.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 DSR_whychoose extends Widget_Base {

	/**
	 * Retrieve the widget name.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'dreamsrent_elementor_whychoose';
	}

	/**
	 * Retrieve the widget title.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'DR Why Choose', 'dreamsrent_elementor' );
	}

	/**
	 * Retrieve the widget icon.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'eicon-icon-box';
	}

	/**
	 * 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 [ 'dreamsrent_elementor_service_card' ];
	}

	/**
	 * 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(
			'title',
			[
				'label' => __( 'Title', 'dreamsrent_elementor' ),
				'type' => Controls_Manager::TEXT,
				"default" => __( 'Easy & Fast Booking', 'dreamsrent_elementor' ),
			]
		);
   
 		$this->add_control(
			'img',
			[
				'label' => __( 'Image', 'dreamsrent_elementor' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);
  
  
		$this->add_control(
			'desc',
			[
				'label' => __( 'Description', 'dreamsrent_elementor' ),
				'type' => Controls_Manager::TEXTAREA,
				"default" => __( 'Completely carinate e business testing process whereas fully researched customer service. Globally extensive content with quality.', 'dreamsrent_elementor' ),
			]
		);

		$this->add_control(
			'class',
			[
				'label' => __( 'Class', 'dreamsrent_elementor' ),
				'type' => Controls_Manager::TEXT,
			]
		);
		

		$this->end_controls_section();

		// Style tab: Title
		$this->start_controls_section(
			'whychoose_title_style',
			[
				'label' => __( 'Title', 'dreamsrent_elementor' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'whychoose_title_color',
			[
				'label'     => __( 'Title Color', 'dreamsrent_elementor' ),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .why-choose-group h4' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'whychoose_title_typography',
				'label'    => __( 'Title Typography', 'dreamsrent_elementor' ),
				'selector' => '{{WRAPPER}} .why-choose-group h4',
			]
		);

		$this->end_controls_section();

		// Style tab: Description
		$this->start_controls_section(
			'whychoose_desc_style',
			[
				'label' => __( 'Description', 'dreamsrent_elementor' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'whychoose_desc_color',
			[
				'label'     => __( 'Description Color', 'dreamsrent_elementor' ),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .why-choose-group p' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'whychoose_desc_typography',
				'label'    => __( 'Description Typography', 'dreamsrent_elementor' ),
				'selector' => '{{WRAPPER}} .why-choose-group p',
			]
		);

		$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="why-choose-group">
<div class="card flex-fill">
								<div class="card-body">
									<div class="choose-img choose-black">
										<img src="<?php echo esc_url( $settings['img']['url'] ); ?>" alt="<?php echo esc_attr( $settings['title'] ); ?>">
									</div>
									<div class="choose-content">
										<h4><?php echo $settings['title']; ?></h4>
										<p><?php echo $settings['desc']; ?></p>
									</div>
								</div>
							</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() {
		?>

		
		<div class="dreamsrentelementor_service_card {{{ settings.class }}} ">
			<img src="{{{ settings.img.url }}}"></img>
			<div class="content  ">
				<h3 class="title">{{{ settings.title }}}</h3>
				<div class="desc">{{{ settings.desc }}}</div>
 			</div>
		</div>
		<?php
	}
}