𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/kinsley-plugin/elementor/widgets//video-section.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Kinsley Video Widget.
*
* @since 1.0
*/
class kinsley_Video_Section_Widget extends Widget_Base {
public function get_name() {
return 'kinsley-video-section';
}
public function get_title() {
return esc_html__( 'Video Section', 'kinsley-plugin' );
}
public function get_icon() {
return 'eicon-parallax';
}
public function get_categories() {
return [ 'kinsley-category' ];
}
/**
* Register widget controls.
*
* @since 1.0
*/
protected function register_controls() {
$this->start_controls_section(
'content_tab',
[
'label' => esc_html__( 'Content', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'video',
[
'label' => esc_html__( 'Video ID (Youtube)', 'kinsley-plugin' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => 'Gu6z6kIukgg',
'placeholder' => esc_html__( 'Gu6z6kIukgg', 'kinsley-plugin' ),
]
);
$this->add_control(
'image',
[
'label' => esc_html__( 'Video Poster (Image)', 'kinsley-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__( 'Item', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'item_bg_color',
[
'label' => esc_html__( 'Button BG Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .kinsley-video .play::before' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'item_border_color',
[
'label' => esc_html__( 'Button Border Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .kinsley-video .play::after' => 'border-color: {{VALUE}};',
],
]
);
$this->add_control(
'item_play_color',
[
'label' => esc_html__( 'Button Play Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .kinsley-video .play .arrow' => 'border-left-color: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
if ( $settings['image']['id'] ) {
$image = wp_get_attachment_image_url( $settings['image']['id'], 'kinsley_1920xAuto' );
} else {
$image = $settings['image']['url'];
}
?>
<div class="kinsley-video">
<?php if ( $image ) : ?>
<div class="image" style="background-image: url(<?php echo esc_url( $image ); ?>);"></div>
<?php endif; ?>
<?php if ( $settings['video'] ) : ?>
<iframe class="js-video-iframe" data-src="https://www.youtube.com/embed/<?php echo esc_attr( $settings['video'] ); ?>?autoplay=1"></iframe>
<?php endif; ?>
<div class="play">
<div class="arrow"></div>
</div>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register( new kinsley_Video_Section_Widget() );