𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/kinsley-plugin/elementor/widgets//about.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Kinsley About Widget.
*
* @since 1.0
*/
class Kinsley_About_Widget extends Widget_Base {
public function get_name() {
return 'kinsley-about';
}
public function get_title() {
return esc_html__( 'About', '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(
'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(
'desc', [
'label' => esc_html__( 'Description', 'kinsley-plugin' ),
'type' => Controls_Manager::WYSIWYG,
'placeholder' => esc_html__( 'Enter description', 'kinsley-plugin' ),
'default' => esc_html__( 'Description', 'kinsley-plugin' ),
]
);
$repeater->add_control(
'more', [
'label' => esc_html__( 'More (Text)', 'kinsley-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Read More', 'kinsley-plugin' ),
'default' => esc_html__( 'Read More', 'kinsley-plugin' ),
]
);
$repeater->add_control(
'link', [
'label' => esc_html__( 'More (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(
'items_styling',
[
'label' => esc_html__( 'Items Styles', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'bg_color',
[
'label' => esc_html__( 'Item BG Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-about-card' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .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-text h2',
]
);
$this->add_control(
'description_color',
[
'label' => esc_html__( 'Description Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-about-text .knsl-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'label' => esc_html__( 'Description Typography', 'kinsley-plugin' ),
'name' => 'description_typography',
'selector' => '{{WRAPPER}} .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-btn' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'button_bg_color',
[
'label' => esc_html__( 'Button BG Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-btn' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'button_bdcolor',
[
'label' => esc_html__( 'Button Border Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-btn' => 'box-shadow: 0 0 0 1px {{VALUE}} !important;',
],
]
);
$this->add_control(
'button_color_hover',
[
'label' => esc_html__( 'Button Color (Hover)', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-btn:hover' => 'color: {{VALUE}} !important;',
'{{WRAPPER}} .knsl-btn:hover svg' => 'fill: {{VALUE}} !important;',
],
]
);
$this->add_control(
'button_bgcolor_hover',
[
'label' => esc_html__( 'Button BG Color (Hover)', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-btn:hover' => 'background-color: {{VALUE}} !important;',
],
]
);
$this->add_control(
'button_bdcolor_hover',
[
'label' => esc_html__( 'Button Border Color (Hover)', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-btn:hover' => 'box-shadow: 0 0 0 1px {{VALUE}} !important;',
],
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
?>
<!-- about -->
<section class="knsl-p-0-100">
<?php if ( $settings['container_type'] == 'basic' ) : ?><div class="container"><?php endif; ?>
<div class="knsl-about-card">
<?php if ( $settings['items'] ) : ?>
<?php $i=0; $total = count( $settings['items'] ); foreach ( $settings['items'] as $index => $item ) : $i++;
$item_title = $this->get_repeater_setting_key( 'title', 'items', $index );
$this->add_inline_editing_attributes( $item_title, 'basic' );
$item_desc = $this->get_repeater_setting_key( 'desc', 'items', $index );
$this->add_inline_editing_attributes( $item_desc, 'advanced' );
$item_more = $this->get_repeater_setting_key( 'more', 'items', $index );
$this->add_inline_editing_attributes( $item_more, 'none' );
?>
<?php if ( $i == 0 || ($i - 1)%2 == 0 ) : ?><div class="row no-gutters"><?php endif; ?>
<div class="col-lg-6<?php if ( $i % 2 == 0 ) : ?> order-lg-2<?php endif; ?>">
<?php if ( $item['image'] ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'kinsley_1920xAuto' ); ?>
<div class="knsl-about-photo">
<img src="<?php echo esc_url( $image ); ?>" alt="" />
</div>
<?php endif; ?>
</div>
<div class="col-lg-6 align-self-center">
<div class="knsl-about-text">
<div class="knsl-title-frame">
<?php if ( $item['title'] ) : ?>
<h2 class="knsl-mb-20">
<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
<?php echo wp_kses_post( $item['title'] ); ?>
</span>
</h2>
<?php endif; ?>
<?php if ( $item['desc'] ) : ?>
<div class="knsl-text knsl-mb-30">
<div <?php echo $this->get_render_attribute_string( $item_desc ); ?>>
<?php echo wp_kses_post( $item['desc'] ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( $item['more'] ) : ?>
<a<?php if ( $item['link'] ) : 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 endif; ?> class="knsl-btn knsl-btn-md">
<span <?php echo $this->get_render_attribute_string( $item_more ); ?>>
<?php echo wp_kses_post( $item['more'] ); ?>
</span>
</a>
<?php endif; ?>
</div>
</div>
</div>
<?php if ( $i % 2 == 0 || $i == $total ) : ?></div><?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php if ( $settings['container_type'] == 'basic' ) : ?><div class="container"><?php endif; ?>
</section>
<!-- about 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() {
?>
<!-- about -->
<section class="knsl-p-0-100">
<div class="container">
<div class="knsl-about-card">
<# if ( settings.items ) { var i = 0; var total = settings.items.length; #>
<# _.each( settings.items, function( item, index ) {
i++;
var item_title = view.getRepeaterSettingKey( 'title', 'items', index );
view.addInlineEditingAttributes( item_title, 'basic' );
var item_desc = view.getRepeaterSettingKey( 'desc', 'items', index );
view.addInlineEditingAttributes( item_desc, 'advanced' );
var item_more = view.getRepeaterSettingKey( 'more', 'items', index );
view.addInlineEditingAttributes( item_more, 'basic' );
#>
<# if ( i == 0 || (i - 1)%2 == 0 ) { #><div class="row no-gutters"><# } #>
<div class="col-lg-6<# if ( i % 2 == 0 ) { #> order-lg-2<# } #>">
<# if ( item.image ) { #>
<div class="knsl-about-photo">
<img src="{{{ item.image.url }}}" alt="" />
</div>
<# } #>
</div>
<div class="col-lg-6 align-self-center">
<div class="knsl-about-text">
<div class="knsl-title-frame">
<# if ( item.title ) { #>
<h2 class="knsl-mb-20">
<span {{{ view.getRenderAttributeString( item_title ) }}}>
{{{ item.title }}}
</span>
</h2>
<# } #>
<# if ( item.desc ) { #>
<div class="knsl-text knsl-mb-30">
<div {{{ view.getRenderAttributeString( item_desc ) }}}>
{{{ item.desc }}}
</div>
</div>
<# } #>
<# if ( item.more ) { #>
<a<# if ( item.link ) { if ( item.link.is_external ) { #> target="_blank"<# } #><# if ( item.link.nofollow ) { #> rel="nofollow"<# } #> href="{{{ item.link.url }}}"<# } #> class="knsl-btn knsl-btn-md">
<span {{{ view.getRenderAttributeString( item_more ) }}}>
{{{ item.more }}}
</span>
</a>
<# } #>
</div>
</div>
</div>
<# if ( i % 2 == 0 || i == total ) { #></div><# } #>
<# }); #>
<# } #>
</div>
</div>
</section>
<!-- about end -->
<?php
}
}
Plugin::instance()->widgets_manager->register( new Kinsley_About_Widget() );