D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
realadss
/
thathagroup.com
/
wp-content
/
themes
/
prooty
/
elementor
/
widgets
/
Filename :
image.php
back
Copy
<?php use Elementor\Widget_Base; use Elementor\Controls_Manager; use \Elementor\Group_Control_Typography; use Elementor\Group_Control_Image_Size; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Prooty_Elementor_Image extends Widget_Base { public function get_name() { return 'prooty_elementor_image'; } public function get_title() { return esc_html__( 'Ova Image', 'prooty' ); } public function get_icon() { return 'eicon-image'; } public function get_categories() { return [ 'prooty' ]; } public function get_script_depends() { return [ '' ]; } protected function register_controls() { $this->start_controls_section( 'section_image', [ 'label' => esc_html__( 'Image', 'prooty' ), ] ); $this->add_control( 'template', [ 'label' => esc_html__( 'Template', 'prooty' ), 'type' => Controls_Manager::SELECT, 'default' => 'template_1', 'options' => [ 'template_1' => esc_html__( 'Template 1', 'prooty' ), 'template_2' => esc_html__( 'Template 2 (mask-image)', 'prooty' ), ] ] ); $this->add_control( 'ova_image', [ 'label' => esc_html__( 'Choose Image', 'prooty' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => \Elementor\Utils::get_placeholder_image_src(), ], ] ); $this->add_responsive_control( 'image_width', [ 'label' => esc_html__( 'Width', 'prooty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 100, 'max' => 800, ], ], 'selectors' => [ '{{WRAPPER}} .ova-image .ova-image-content img' => 'width: {{SIZE}}{{UNIT}}', ], ] ); $this->add_responsive_control( 'image_height', [ 'label' => esc_html__( 'Height', 'prooty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 200, 'max' => 800, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-image .ova-image-content img' => 'height: {{SIZE}}{{UNIT}}', ], ] ); $this->add_responsive_control( 'overlay_image_heading', [ 'label' => esc_html__( 'Overlay', 'prooty' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'template' => 'template_1' ] ] ); $this->add_responsive_control( 'bg_overlay_width', [ 'label' => esc_html__( 'Width', 'prooty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ova-image .text' => 'width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'template' => 'template_1' ] ] ); $this->add_responsive_control( 'bg_overlay_height', [ 'label' => esc_html__( 'Height', 'prooty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-image .text' => 'height: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'template' => 'template_1' ] ] ); $this->add_control( 'bgcolor_overlay', [ 'label' => esc_html__( 'Background Color', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-image .text' => 'background-color: {{VALUE}};', ], 'condition' => [ 'template' => 'template_1' ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_options', [ 'label' => esc_html__( 'Options ( Line, Text, Background )', 'prooty' ), ] ); $this->add_control( 'line_heading', [ 'label' => esc_html__( 'Line Decoration', 'prooty' ), 'type' => \Elementor\Controls_Manager::HEADING, ] ); $this->add_control( 'show_line', [ 'label' => esc_html__( 'Show Line', 'prooty' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'options' => [ 'yes' => esc_html__( 'Yes', 'prooty' ), 'no' => esc_html__( 'No', 'prooty' ), ], 'frontend_available' => true, ] ); $this->add_control( 'line_color', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-image .line-decor' => 'background-color : {{VALUE}};', ], 'condition' => [ 'show_line' => 'yes', ] ] ); $this->add_control( 'text_heading', [ 'label' => esc_html__( 'Text', 'prooty' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before' ] ); $this->add_control( 'text', [ 'label' => esc_html__( 'Text', 'prooty' ), 'type' => Controls_Manager::TEXTAREA, 'default' => esc_html__('Your Text', 'prooty'), ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'text_typography', 'selector' => '{{WRAPPER}} .ova-image .text', 'condition' => [ 'text!' => '', ] ] ); $this->add_control( 'text_color', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-image .text' => 'color : {{VALUE}};', ], 'condition' => [ 'text!' => '', ] ] ); $this->add_control( 'background_heading', [ 'label' => esc_html__( 'Background', 'prooty' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before' ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'image_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ova-image:after', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_background_image_overlay', [ 'label' => esc_html__( 'Background Image Overlay', 'prooty' ), ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'overlay_image_background', 'types' => [ 'classic' ], 'selector' => '{{WRAPPER}} .ova-image:before', ] ); $this->end_controls_section(); } // Render Template Here protected function render() { $settings = $this->get_settings(); if ( empty( $settings['ova_image']['url'] ) ) { return; } $template = $settings['template']; // image $image = $settings['ova_image']; $img_alt = isset( $image['alt'] ) ? $image['alt'] : esc_html__('Single Property Image','prooty'); // text $text = $settings['text']; // show line $show_line = $settings['show_line']; ?> <div class="ova-image <?php echo esc_attr( $template ); ?>"> <div class="ova-image-content"> <?php if( $template == 'template_1' ) { ?> <span class="text overlay"><?php echo esc_html( $text ); ?></span> <?php } ?> <img src="<?php echo esc_url( $image['url'] ); ?>" alt="<?php echo esc_attr( $img_alt ); ?>"> <?php if( $show_line == 'yes' ) { ?> <div class="line-decor"></div> <?php } ?> </div> <?php if( $template == 'template_2' ) { ?> <span class="text overlay"><?php echo esc_html( $text ); ?></span> <?php } ?> </div> <?php } } $widgets_manager->register( new Prooty_Elementor_Image() );