𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/kinsley-plugin/elementor/widgets//about-gallery.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Kinsley About Gallery Widget.
*
* @since 1.0
*/
class Kinsley_About_Gallery_Widget extends Widget_Base {
public function get_name() {
return 'kinsley-about-gallery';
}
public function get_title() {
return esc_html__( 'Slider Gallery', '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(
'title_tab',
[
'label' => esc_html__( 'Title', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$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(
'title_tag',
[
'label' => esc_html__( 'Title Tag', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'h2',
'options' => [
'h1' => __( 'H1', 'kinsley-plugin' ),
'h2' => __( 'H2', 'kinsley-plugin' ),
'h3' => __( 'H3', 'kinsley-plugin' ),
'h4' => __( 'H4', 'kinsley-plugin' ),
'div' => __( 'DIV', 'kinsley-plugin' ),
],
]
);
$this->add_control(
'title_align',
[
'label' => esc_html__( 'Title Align', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'default',
'options' => [
'default' => __( 'Default', 'kinsley-plugin' ),
'left' => __( 'Left', 'kinsley-plugin' ),
],
]
);
$this->add_control(
'description',
[
'label' => esc_html__( 'Description', 'kinsley-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter description', 'kinsley-plugin' ),
'default' => esc_html__( 'Description', 'kinsley-plugin' ),
]
);
$this->add_control(
'more',
[
'label' => esc_html__( 'Button (label)', 'kinsley-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Button', 'kinsley-plugin' ),
]
);
$this->add_control(
'link',
[
'label' => esc_html__( 'Button (link)', 'kinsley-plugin' ),
'type' => Controls_Manager::URL,
'show_external' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'items_tab',
[
'label' => esc_html__( 'Items', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'container_type',
[
'label' => esc_html__( 'Container', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'basic',
'options' => [
'basic' => __( 'Basic', 'kinsley-plugin' ),
'full' => __( 'Full', 'kinsley-plugin' ),
],
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'image', [
'label' => esc_html__( 'Image', 'kinsley-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'title', [
'label' => esc_html__( 'Title', 'kinsley-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter title', 'kinsley-plugin' ),
'default' => esc_html__( 'Enter title', 'kinsley-plugin' ),
]
);
$repeater->add_control(
'link', [
'label' => esc_html__( 'Link', 'kinsley-plugin' ),
'type' => Controls_Manager::URL,
'show_external' => true,
]
);
$this->add_control(
'items',
[
'label' => esc_html__( 'Items', 'kinsley-plugin' ),
'type' => Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'settings_tab',
[
'label' => esc_html__( 'Settings', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'bg_position',
[
'label' => esc_html__( 'BG Transition Position', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'top' => __( 'Top', 'kinsley-plugin' ),
'bottom' => __( 'Bottom', 'kinsley-plugin' ),
'middle' => __( 'Middle', 'kinsley-plugin' ),
'none' => __( 'None', 'kinsley-plugin' ),
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'title_styling',
[
'label' => esc_html__( 'Title', '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-title-frame .knsl-title--h' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Title Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-title-frame .knsl-title--h',
]
);
$this->add_control(
'description_color',
[
'label' => esc_html__( 'Description Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-title-frame .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-title-frame .knsl-text',
]
);
$this->add_control(
'button_color',
[
'label' => esc_html__( 'Button Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-title-frame .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-title-frame .knsl-btn' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'label' => esc_html__( 'Button Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-title-frame .knsl-btn',
]
);
$this->end_controls_section();
$this->start_controls_section(
'items_styling',
[
'label' => esc_html__( 'Items', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'item_title_color',
[
'label' => esc_html__( 'Title Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-image-frame .knsl-badge' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'item_title_bgcolor',
[
'label' => esc_html__( 'Title Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-image-frame .knsl-badge' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_title_typography',
'label' => esc_html__( 'Title Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-image-frame .knsl-badge',
]
);
$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( 'more', 'none' );
$this->add_inline_editing_attributes( 'title', 'basic' );
$this->add_inline_editing_attributes( 'description', 'basic' );
$theme_lightbox = get_field( 'portfolio_lightbox_disable', 'option' );
?>
<!-- gallery -->
<section class="knsl-transition-<?php echo esc_attr( $settings['bg_position'] ); ?> knsl-p-0-100">
<?php kinsley_deco_svg( 'left' ); ?>
<?php if ( $settings['container_type'] == 'basic' ) : ?><div class="container"><?php endif; ?>
<div class="row align-items-center">
<?php if ( $settings['title'] || $settings['more'] || $settings['description'] ) : ?>
<div class="col-lg-12">
<div class="knsl-center knsl-title-frame knsl-scroll-animation knsl-mb-100<?php if ( $settings['title_align'] == 'left' ) : ?> knsl-title-left<?php endif; ?>">
<?php if ( $settings['title'] ) : ?>
<<?php echo esc_attr( $settings['title_tag'] ); ?> class="knsl-title--h knsl-mb-20">
<span <?php echo $this->get_render_attribute_string( 'title' ); ?>>
<?php echo wp_kses_post( $settings['title'] ); ?>
</span>
</<?php echo esc_attr( $settings['title_tag'] ); ?>>
<?php endif; ?>
<?php if ( $settings['description'] ) : ?>
<div class="knsl-text knsl-mb-30">
<p>
<span <?php echo $this->get_render_attribute_string( 'description' ); ?>>
<?php echo wp_kses_post( $settings['description'] ); ?>
</span>
</p>
</div>
<?php endif; ?>
<?php if ( $settings['more'] ) : ?>
<a<?php if ( $settings['link'] ) : 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="knsl-btn knsl-btn-md">
<span <?php echo $this->get_render_attribute_string( 'more' ); ?>>
<?php echo wp_kses_post( $settings['more'] ); ?>
</span>
</a>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if ( $settings['items'] ) : ?>
<div class="col-lg-12<?php if ( $settings['container_type'] == 'full' ) : ?> knsl-about-slider-fully<?php endif; ?>">
<!-- slider -->
<div class="swiper-container knsl-about-slider knsl-scroll-animation">
<div class="swiper-wrapper">
<?php foreach ( $settings['items'] as $index => $item ) :
$item_title = $this->get_repeater_setting_key( 'title', 'items', $index );
$this->add_inline_editing_attributes( $item_title, 'basic' );
?>
<div class="swiper-slide">
<!-- gallery item -->
<div class="knsl-image-frame">
<?php if ( $item['image'] ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'kinsley_1920xAuto' ); $thumb = wp_get_attachment_image_url( $item['image']['id'], 'kinsley_1920xAuto' ); ?>
<?php if ( !empty( $item['link']['url'] ) ) : ?>
<a<?php if ( $item['link']['is_external'] ) : ?> target="_blank"<?php endif; ?><?php if ( $item['link']['nofollow'] ) : ?> rel="nofollow"<?php endif; ?> href="<?php echo esc_url( $item['link']['url'] ); ?>">
<?php else : ?>
<a<?php if ( ! $theme_lightbox ) : ?> data-magnific-gallery<?php endif; ?> data-elementor-lightbox-slideshow="about-gallery" data-elementor-lightbox-title="<?php echo esc_attr( $item['title'] ); ?>" href="<?php echo esc_url( $image ); ?>">
<?php endif; ?>
<img src="<?php echo esc_url( $thumb ); ?>" alt="<?php echo esc_attr( $item['title'] ); ?>" />
<?php if ( $item['title'] ) : ?>
<div class="knsl-badge">
<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
<?php echo wp_kses_post( $item['title'] ); ?>
</span>
</div>
<?php endif; ?>
<span class="knsl-zoom"><i class="fas fa-search-plus"></i></span>
</a>
<?php endif; ?>
</div>
<!-- gallery item end -->
</div>
<?php endforeach; ?>
</div>
<!-- slider navigation -->
<div class="knsl-slider-nav-panel">
<!-- pagination -->
<div class="knsl-about-slider-1-pagination"></div>
<!-- navigation -->
<div class="knsl-about-slider-nav">
<div class="knsl-about-slider-1-prev"><i class="fas fa-arrow-left"></i></div>
<div class="knsl-about-slider-1-next"><i class="fas fa-arrow-right"></i></div>
</div>
<!-- navigation end -->
</div>
<!-- slider navigation end -->
</div>
<!-- slider end -->
</div>
<?php endif; ?>
</div>
<?php if ( $settings['container_type'] == 'basic' ) : ?></div><?php endif; ?>
</section>
<!-- gallery 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( 'more', 'none' );
view.addInlineEditingAttributes( 'title', 'basic' );
view.addInlineEditingAttributes( 'description', 'basic' );
#>
<!-- gallery -->
<section class="knsl-transition-{{{ settings.bg_position }}} knsl-p-0-100">
<div class="container">
<div class="row align-items-center">
<# if ( settings.title || settings.more || settings.description ) { #>
<div class="col-lg-12">
<div class="knsl-center knsl-title-frame knsl-scroll-animation knsl-mb-100<# if ( settings.title_align == 'left' ) { #> knsl-title-left<# } #>">
<# if ( settings.title ) { #>
<{{{ settings.title_tag }}} class="knsl-title--h knsl-mb-20">
<span {{{ view.getRenderAttributeString( 'title' ) }}}>
{{{ settings.title }}}
</span>
</{{{ settings.title_tag }}}>
<# } #>
<# if ( settings.description ) { #>
<div class="knsl-text knsl-mb-30">
<p>
<span {{{ view.getRenderAttributeString( 'description' ) }}}>
{{{ settings.description }}}
</span>
</p>
</div>
<# } #>
<# if ( settings.more ) { #>
<a<# if ( settings.link ) { if ( settings.link.is_external ) { #> target="_blank"<# } #><# if ( settings.link.nofollow ) { #> rel="nofollow"<# } #> href="{{{ settings.link.url }}}"<# } #> class="knsl-btn knsl-btn-md">
<span {{{ view.getRenderAttributeString( 'more' ) }}}>
{{{ settings.more }}}
</span>
</a>
<# } #>
</div>
</div>
<# } #>
<# if ( settings.items ) { #>
<div class="col-lg-12">
<!-- slider -->
<div class="swiper-container knsl-about-slider knsl-scroll-animation">
<div class="swiper-wrapper">
<# _.each( settings.items, function( item, index ) {
var item_title = view.getRepeaterSettingKey( 'title', 'items', index );
view.addInlineEditingAttributes( item_title, 'basic' );
#>
<div class="swiper-slide">
<!-- gallery item -->
<div class="knsl-image-frame">
<# if ( item.image ) { #>
<a data-elementor-lightbox-slideshow="gallery" data-elementor-lightbox-title="{{{ item.title }}}" href="{{{ item.image.url }}}">
<img src="{{{ item.image.url }}}" alt="{{{ item.title }}}" />
<# if ( item.title ) { #>
<div class="knsl-badge">
<span {{{ view.getRenderAttributeString( item_title ) }}}>
{{{ item.title }}}
</span>
</div>
<# } #>
<span class="knsl-zoom"><i class="fas fa-search-plus"></i></span>
</a>
<# } #>
</div>
<!-- gallery item end -->
</div>
<# }); #>
</div>
<!-- slider navigation -->
<div class="knsl-slider-nav-panel">
<!-- pagination -->
<div class="knsl-about-slider-1-pagination"></div>
<!-- navigation -->
<div class="knsl-about-slider-nav">
<div class="knsl-about-slider-1-prev"><i class="fas fa-arrow-left"></i></div>
<div class="knsl-about-slider-1-next"><i class="fas fa-arrow-right"></i></div>
</div>
<!-- navigation end -->
</div>
<!-- slider navigation end -->
</div>
<!-- slider end -->
</div>
<# } #>
</div>
</div>
</section>
<!-- gallery end -->
<?php
}
}
Plugin::instance()->widgets_manager->register( new Kinsley_About_Gallery_Widget() );