File: /home/tvypkwena2lu/public_html/wp-content/plugins/widgets/gvs-video-overview.php
<?php
/**
* Elementor oEmbed Widget.
*
* Elementor widget that inserts an embbedable content into the page, from any given URL.
*
* @since 1.0.0
*/
class Elementor_VideoOverWiew_Widget extends \Elementor\Widget_Base {
public function get_name() {
return 'video_overview';
}
public function get_title() {
return __( 'GVS Video Overview', 'plugin-name' );
}
public function get_icon() {
return 'fa fa-code';
}
public function get_categories() {
return [ 'theme-specific-category' ];
}
protected function _register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Content', 'plugin-name' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'plugin-name' ),
'type' => \Elementor\Controls_Manager::TEXT,
'input_type' => 'text',
'placeholder' => __( 'Welcome to <br>Video Overview', 'plugin-name' ),
'default' => 'Welcome to <br>Video Overview',
]
);
$this->add_control(
'subtitle',
[
'label' => __( 'Sub Title', 'plugin-name' ),
'type' => \Elementor\Controls_Manager::TEXT,
'input_type' => 'text',
'placeholder' => __( 'Click above button for video', 'plugin-name' ),
'default' => 'Click above button for video',
]
);
$this->add_control(
'image',
[
'label' => __( 'Choose Image', 'plugin-domain' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'website_link',
[
'label' => __( 'You Tube Video URL', 'plugin-domain' ),
'type' => \Elementor\Controls_Manager::URL,
'placeholder' => __( 'https://youtu.be/RIuKQPg5npE', 'plugin-domain' ),
'show_external' => true,
'default' => [
'url' => 'https://youtu.be/RIuKQPg5npE',
'is_external' => false,
'nofollow' => true,
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$target = $settings['website_link']['is_external'] ? ' target="_blank"' : '';
$nofollow = $settings['website_link']['nofollow'] ? ' rel="nofollow"' : '';
$vboxclass='';
if(!$settings['website_link']['is_external']) {
$vboxclass=' class="venobox vbox-item" data-autoplay="true" data-vbtype="video"';
}
$style='';
if(!empty($settings['image']['url'])) {
$style='background: linear-gradient(rgba(117, 47, 138,0.7) 100%, rgba(117, 47, 138,0.7) 100%),url('.$settings['image']['url'].');';
//$style='background-image: url('.$settings['image']['url'].');';
}
echo '
<div class="video-blk d-flex flex-column justify-content-center" style="'.$style.'">
<h2>'.$settings['title'].'</h2>
<a href="'.$settings['website_link']['url']. '" '.$vboxclass. $target. '>
<img src="'.get_template_directory_uri().'/images/video-icon.png" alt="icon">
</a>
<p>'.$settings['subtitle'].'</p>
</div>
';
}
}