File: /mnt/data/dreamssalon-wp/wp-content/plugins/dreamsalon-widgets/widgets/class-video-two.php
<?php
namespace dreamsalonelementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
if ( ! defined( 'ABSPATH' ) ) { exit; }
class DSVideoTwo extends Widget_Base {
public function get_name() { return 'dreamsalon-video-two'; }
public function get_title() { return __( 'DS Video 2', 'dreamsalon_elementor' ); }
public function get_icon() { return 'eicon-video-camera'; }
public function get_categories() { return [ 'dreamsalonelemetortheme' ]; }
protected function _register_controls() {
// Content section
$this->start_controls_section('section_content', [ 'label' => __( 'Content', 'dreamsalon_elementor' ) ]);
$this->add_control('video_source', [
'label' => __( 'Video Source URL', 'dreamsalon_elementor' ),
'type' => Controls_Manager::URL,
'default' => [ 'url' => get_template_directory_uri() . '/assets/img/video/video.mp4' ],
]);
$this->add_control('heading_text', [
'label' => __( 'Heading', 'dreamsalon_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => 'We are an awesome team wellness lovers',
]);
$this->add_control('description_text', [
'label' => __( 'Description', 'dreamsalon_elementor' ),
'type' => Controls_Manager::TEXTAREA,
'default' => 'We believe that exercise isn\'t just about how it makes you look, but also how it makes you feel.',
]);
$this->add_control('button_text', [
'label' => __( 'Button Text', 'dreamsalon_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => 'Join as a Consitant',
]);
$this->add_control('button_link', [
'label' => __( 'Button Link', 'dreamsalon_elementor' ),
'type' => Controls_Manager::URL,
'default' => [ 'url' => '#' ],
]);
// $this->add_control('play_button_link', [
// 'label' => __( 'Play Button Link', 'dreamsalon_elementor' ),
// 'type' => Controls_Manager::URL,
// 'default' => [ 'url' => '#' ],
// ]);
$this->add_control('tagline_text', [
'label' => __( 'Tagline Text', 'dreamsalon_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => 'Body <span>+</span> Soul',
'description' => __( 'You can use basic HTML like <span> in this field.', 'dreamsalon_elementor' ),
]);
$this->end_controls_section();
// Style controls
$this->start_controls_section(
'section_style',
[
'label' => __( 'Style', 'dreamsalon_elementor' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'heading_typography',
'label' => __( 'Heading Typography', 'dreamsalon_elementor' ),
'selector' => '{{WRAPPER}} .video-section .video-info h2',
]
);
$this->end_controls_section();
}
protected function render() {
$s = $this->get_settings_for_display();
$video_url = ! empty( $s['video_source']['url'] ) ? $s['video_source']['url'] : '';
$heading = ! empty( $s['heading_text'] ) ? $s['heading_text'] : '';
$desc = ! empty( $s['description_text'] ) ? $s['description_text'] : '';
$btn_text = ! empty( $s['button_text'] ) ? $s['button_text'] : '';
$btn_link = ! empty( $s['button_link']['url'] ) ? $s['button_link']['url'] : '';
// $play_link = ! empty( $s['play_button_link']['url'] ) ? $s['play_button_link']['url'] : '#';
$tagline = isset( $s['tagline_text'] ) ? $s['tagline_text'] : '';
?>
<section class="video-section section">
<div class="overlay"></div>
<?php if ( $video_url ) : ?>
<video playsinline="playsinline" muted="muted" loop="loop">
<source src="<?php echo esc_url( $video_url ); ?>" type="video/mp4">
</video>
<?php endif; ?>
<div class="video-content h-100">
<div class="container">
<div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
<div class="video-info">
<?php if ( $heading ) : ?>
<h2><?php echo esc_html( $heading ); ?></h2>
<?php endif; ?>
<?php if ( $desc ) : ?>
<p><?php echo esc_html( $desc ); ?></p>
<?php endif; ?>
<?php if ( $btn_text && $btn_link ) : ?>
<a href="<?php echo esc_url( $btn_link ); ?>" class="btn btn-primary d-inline-flex align-items-center rounded-pill"><?php echo esc_html( $btn_text ); ?><i class="ti ti-chevron-right ms-1"></i></a>
<?php endif; ?>
</div>
<a href="javascript:void(0)" class="video-btn"><i class="ti ti-player-play-filled"></i></a>
<div class="video-slag">
<?php if ( $tagline ) : ?>
<p class="video-tagline"><?php echo wp_kses_post( $tagline ); ?></p>
<?php endif; ?>
</div>
</div>
</div>
</div>
</section>
<?php
}
}