𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/kinsley-plugin/elementor/widgets//buttons.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Kinsley Header Buttons Widget.
*
* @since 1.0
*/
class Kinsley_Buttons_Widget extends Widget_Base {
public function get_name() {
return 'kinsley-buttons';
}
public function get_title() {
return esc_html__( 'Button', '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(
'button_white',
[
'label' => esc_html__( 'Button Transparent', 'kinsley-plugin' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => __( 'Yes', 'kinsley-plugin' ),
'label_off' => __( 'No', 'kinsley-plugin' ),
'return_value' => 'yes',
'default' => 'no',
]
);
$this->add_control(
'icon',
[
'label' => esc_html__( 'Button (icon)', 'kinsley-plugin' ),
'type' => Controls_Manager::ICONS,
]
);
$this->add_control(
'button',
[
'label' => esc_html__( 'Button (label)', 'kinsley-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Button', 'kinsley-plugin' ),
'default' => esc_html__( 'Button', 'kinsley-plugin' ),
]
);
$this->add_control(
'link',
[
'label' => esc_html__( 'Button (link)', 'kinsley-plugin' ),
'type' => Controls_Manager::URL,
'show_external' => true,
]
);
$this->add_responsive_control(
'align',
[
'label' => __( 'Alignment', 'kinsley-plugin' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __( 'Left', 'kinsley-plugin' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __( 'Center', 'kinsley-plugin' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __( 'Right', 'kinsley-plugin' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}};',
],
'default' => 'left',
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_styling',
[
'label' => esc_html__( 'Styles', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'button_color',
[
'label' => esc_html__( 'Button Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-btn' => 'color: {{VALUE}} !important;',
'{{WRAPPER}} .knsl-btn svg' => 'fill: {{VALUE}} !important;',
],
]
);
$this->add_control(
'button_bgcolor',
[
'label' => esc_html__( 'Button BG Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-btn' => 'background-color: {{VALUE}} !important;',
],
]
);
$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->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'label' => esc_html__( 'Button Typography:', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-btn',
]
);
$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( 'button', 'none' );
?>
<!-- action button -->
<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_attr( $settings['link']['url'] ); ?>"<?php endif; ?> class="knsl-btn knsl-btn-md<?php if ( $settings['button_white'] == 'yes' ) : ?> knsl-btn-white<?php endif; ?>">
<?php \Elementor\Icons_Manager::render_icon( $settings['icon'], [ 'aria-hidden' => 'true' ] ); ?>
<span <?php echo $this->get_render_attribute_string( 'button' ); ?>>
<?php echo wp_kses_post( $settings['button'] ); ?>
</span>
</a>
<!-- action button end -->
<?php
}
}
Plugin::instance()->widgets_manager->register( new Kinsley_Buttons_Widget() );