𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/kinsley-plugin/elementor/widgets//about-video.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Kinsley About Video Widget.
*
* @since 1.0
*/
class Kinsley_About_Video_Widget extends Widget_Base {
public function get_name() {
return 'kinsley-about-video';
}
public function get_title() {
return esc_html__( 'About Video', '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(
'image',
[
'label' => esc_html__( 'Image', 'kinsley-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'title',
[
'label' => esc_html__( 'Title', 'kinsley-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter title', 'kinsley-plugin' ),
'default' => esc_html__( 'Title', 'kinsley-plugin' ),
]
);
$this->add_control(
'description',
[
'label' => esc_html__( 'Description', 'kinsley-plugin' ),
'type' => Controls_Manager::WYSIWYG,
'placeholder' => esc_html__( 'Enter your description', 'kinsley-plugin' ),
'default' => esc_html__( 'Type your description here', 'kinsley-plugin' ),
]
);
$this->add_control(
'button',
[
'label' => esc_html__( 'Button', 'kinsley-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter button', 'kinsley-plugin' ),
'default' => esc_html__( 'Button', 'kinsley-plugin' ),
]
);
$this->add_control(
'video',
[
'label' => esc_html__( 'Youtube (Video ID)', 'kinsley-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'wsq-r8lMMsk', 'kinsley-plugin' ),
'default' => esc_html__( 'wsq-r8lMMsk', 'kinsley-plugin' ),
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_styling',
[
'label' => esc_html__( 'Content Styles', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-about-card .knsl-about-text h2' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Title Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-about-card .knsl-about-text h2',
]
);
$this->add_control(
'description_color',
[
'label' => esc_html__( 'Description Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-about-card .knsl-about-text .knsl-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'description_typography',
'label' => esc_html__( 'Description Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-about-card .knsl-about-text .knsl-text',
]
);
$this->add_control(
'button_color',
[
'label' => esc_html__( 'Button Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-about-card .knsl-about-text .knsl-btn' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'button_bgcolor',
[
'label' => esc_html__( 'Button BG Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-about-card .knsl-about-text .knsl-btn' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'label' => esc_html__( 'Button Typography', 'kinsley-plugin' ),
'name' => 'button_typography',
'selector' => '{{WRAPPER}} .knsl-about-card .knsl-about-text .knsl-btn',
]
);
$this->add_control(
'play_button_color',
[
'label' => esc_html__( 'Play Button Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-video-frame .knsl-play-btn' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'play_button_bgcolor',
[
'label' => esc_html__( 'Play Button BG Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-video-frame .knsl-play-btn' => 'background-color: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
$this->add_inline_editing_attributes( 'title', 'basic' );
$this->add_inline_editing_attributes( 'description', 'advanced' );
$this->add_inline_editing_attributes( 'button', 'none' );
?>
<!-- video -->
<section class="knsl-p-0-100">
<div class="container">
<div class="knsl-about-card">
<div class="row g-0">
<div class="col-lg-6">
<div class="knsl-about-text">
<div class="knsl-title-frame">
<?php if ( $settings['title'] ) : ?>
<h2 class="knsl-title--h knsl-mb-20">
<span <?php echo $this->get_render_attribute_string( 'title' ); ?>>
<?php echo wp_kses_post( $settings['title'] ); ?>
</span>
</h2>
<?php endif; ?>
<?php if ( $settings['description'] ) : ?>
<div class="knsl-text knsl-mb-30">
<div <?php echo $this->get_render_attribute_string( 'description' ); ?>>
<?php echo wp_kses_post( $settings['description'] ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( $settings['button'] ) : ?>
<a data-magnific-video href="https://www.youtube.com/watch?v=<?php echo esc_attr( $settings['video'] ); ?>" class="knsl-btn knsl-btn-md">
<span class="img-svg img-svg-play knsl-zoom"></span>
<span <?php echo $this->get_render_attribute_string( 'button' ); ?>>
<?php echo wp_kses_post( $settings['button'] ); ?>
</span>
</a>
<?php endif; ?>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="knsl-video-frame">
<?php if ( $settings['image'] ) : $image = wp_get_attachment_image_url( $settings['image']['id'], 'kinsley_1920xAuto' ); ?>
<img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $settings['title'] ); ?>" />
<?php endif; ?>
<?php if ( $settings['video'] ) : ?>
<a data-magnific-video href="https://www.youtube.com/watch?v=<?php echo esc_attr( $settings['video'] ); ?>" class="knsl-play-btn">
<i class="fas fa-play"></i>
</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- video 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() {
?>
<#
view.addInlineEditingAttributes( 'title', 'basic' );
view.addInlineEditingAttributes( 'description', 'advanced' );
view.addInlineEditingAttributes( 'button', 'none' );
#>
<!-- video -->
<section class="knsl-p-0-100">
<div class="container">
<div class="knsl-about-card">
<div class="row g-0">
<div class="col-lg-6">
<div class="knsl-about-text">
<div class="knsl-title-frame">
<# if ( settings.title ) { #>
<h2 class="knsl-title--h knsl-mb-20">
<span {{{ view.getRenderAttributeString( 'title' ) }}}>
{{{ settings.title }}}
</span>
</h2>
<# } #>
<# if ( settings.description ) { #>
<div class="knsl-text knsl-mb-30">
<div {{{ view.getRenderAttributeString( 'description' ) }}}>
{{{ settings.description }}}
</div>
</div>
<# } #>
<# if ( settings.button ) { #>
<a data-magnific-video href="https://www.youtube.com/watch?v={{{ settings.video }}}" class="knsl-btn knsl-btn-md">
<span class="img-svg img-svg-play knsl-zoom"></span>
<span {{{ view.getRenderAttributeString( 'button' ) }}}>
{{{ settings.button }}}
</span>
</a>
<# } #>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="knsl-video-frame">
<# if ( settings.image ) { #>
<img src="{{{ settings.image.url }}}" alt="{{{ settings.title }}}" />
<# } #>
<# if ( settings.video ) { #>
<a data-magnific-video href="https://www.youtube.com/watch?v={{{ settings.video }}}" class="knsl-play-btn">
<i class="fas fa-play"></i>
</a>
<# } #>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- video end -->
<?php
}
}
Plugin::instance()->widgets_manager->register( new Kinsley_About_Video_Widget() );