File: //home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/video-section.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Lesya Started Widget.
*
* @since 1.0
*/
class Lesya_Video_Section_Widget extends Widget_Base {
public function get_name() {
return 'lesya-video-section';
}
public function get_title() {
return esc_html__( 'Video Section', '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(
'video_tab',
[
'label' => esc_html__( 'Video', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'link',
[
'label' => esc_html__( 'Video URL', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::URL,
'show_external' => true,
]
);
$this->add_control(
'image',
[
'label' => esc_html__( 'Video Image', 'lesya-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'alt',
[
'label' => esc_html__( 'Alt', 'lesya-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter Alt', 'lesya-plugin' ),
'default' => esc_html__( 'Alt', '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(
'icon', [
'label' => esc_html__( 'Icon', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::ICONS,
]
);
$repeater->add_control(
'bg-text', [
'label' => esc_html__( 'BG Text', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter Text', 'lesya-plugin' ),
'default' => esc_html__( 'Text', 'lesya-plugin' ),
]
);
$repeater->add_control(
'title', [
'label' => esc_html__( 'Title', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
'default' => esc_html__( 'Title', 'lesya-plugin' ),
]
);
$repeater->add_control(
'description', [
'label' => esc_html__( 'Description', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter description', 'lesya-plugin' ),
'default' => esc_html__( 'Description', 'lesya-plugin' ),
]
);
$this->add_control(
'items',
[
'label' => esc_html__( 'Items', 'lesya-plugin' ),
'type' => Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'image_tab',
[
'label' => esc_html__( 'Image Shape', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'image-shape',
[
'label' => esc_html__( 'Image', 'lesya-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'items_styling',
[
'label' => esc_html__( 'Items Styling', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'item_title_color',
[
'label' => esc_html__( 'Title Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .booking-two-item h3' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_title_typography',
'label' => esc_html__( 'Title Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .booking-two-item h3',
]
);
$this->add_control(
'item_bgtext_color',
[
'label' => esc_html__( 'BG Text Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .booking-two-item .bg-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_bgtext_typography',
'label' => esc_html__( 'BG Text Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .booking-two-item .bg-text',
]
);
$this->add_control(
'item_list_color',
[
'label' => esc_html__( 'List Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .booking-two-item ul li' => 'color: {{VALUE}};',
'{{WRAPPER}} .booking-two-item ul li svg' => 'fill: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_list_typography',
'label' => esc_html__( 'List Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .booking-two-item ul li',
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
?>
<!-- Video Area Start -->
<?php if ( $settings['image'] ) : $image = wp_get_attachment_image_url( $settings['image']['id'], 'lesya_1920xAuto' ); ?>
<div class="video-section rel z-1">
<div class="container">
<div class="video-inner wow fadeInUp delay-0-2s">
<img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $settings['alt'] ); ?>">
<a<?php if ( $settings['link'] ) : ?><?php if ( $settings['link']['is_external'] ) : ?> target="_blank"<?php endif; ?><?php if ( $settings['link']['nofollow'] ) : ?> rel="nofollow"<?php endif; ?> href="<?php echo esc_url( $settings['link']['url'] ); ?>"<?php endif; ?> class="mfp-iframe video-play mb-10">
<i class="fas fa-play"></i>
</a>
</div>
</div>
</div>
<?php endif; ?>
<!-- Video Area End -->
<!-- Booking Section Start -->
<?php if ( $settings['items'] ) : ?>
<section class="booking-section-two rel text-white pt-120 rpt-95 pb-30">
<div class="container">
<div class="row">
<?php $i = 0; foreach ( $settings['items'] as $index => $item ) :
$i = $i+2;
$item_bg_text = $this->get_repeater_setting_key( 'bg-text', 'items', $index );
$this->add_inline_editing_attributes( $item_bg_text, 'basic' );
$item_title = $this->get_repeater_setting_key( 'title', 'items', $index );
$this->add_inline_editing_attributes( $item_title, 'basic' );
$item_description = $this->get_repeater_setting_key( 'description', 'items', $index );
$this->add_inline_editing_attributes( $item_description, 'basic' );
?>
<div class="col-lg-4 col-md-6">
<div class="booking-two-item wow fadeInUp delay-0-<?php echo esc_attr( $i ); ?>s">
<?php if ( $item['bg-text'] ) : ?>
<span class="bg-text">
<span <?php echo $this->get_render_attribute_string( $item_bg_text ); ?>>
<?php echo wp_kses_post( $item['bg-text'] ); ?>
</span>
</span>
<?php endif; ?>
<?php if ( $item['title'] ) : ?>
<h3>
<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
<?php echo wp_kses_post( $item['title'] ); ?>
</span>
</h3>
<?php endif; ?>
<ul>
<li>
<?php if ( $item['icon'] ) : ?>
<?php \Elementor\Icons_Manager::render_icon( $item['icon'], [ 'aria-hidden' => 'true' ] ); ?>
<?php endif; ?>
<?php if ( $item['description'] ) : ?>
<div class="booking-info">
<div <?php echo $this->get_render_attribute_string( $item_description ); ?>>
<?php echo wp_kses_post( $item['description'] ); ?>
</div>
</div>
<?php endif; ?>
</li>
</ul>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php if ( $settings['image-shape'] ) : $image_shape = wp_get_attachment_image_url( $settings['image-shape']['id'], 'full' ); ?>
<div class="booking-section-bg bgs-cover bg-green" style="background-image: url(<?php echo esc_url( $image_shape ); ?>);"></div>
<?php endif; ?>
</section>
<?php endif; ?>
<!-- Booking 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_Video_Section_Widget() );