<?php
/**
* Elementor Single Widget
* @package Prinox Tools
* @since 1.0.0
*/
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
class Prinox_Button extends Widget_Base {
/**
* Get widget name.
*
* Retrieve Elementor widget name.
*
* @since 1.0.0
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'prionx-btn-id';
}
/**
* Get widget title.
*
* Retrieve Elementor widget title.
*
* @since 1.0.0
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Prinox Button', 'prinox-tools' );
}
/**
* Get widget icon.
*
* Retrieve Elementor widget icon.
*
* @since 1.0.0
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'mg-custom-icon';
}
/**
* Get widget categories.
*
* Retrieve the list of categories the Elementor widget belongs to.
*
* @since 1.0.0
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'prinox_widgets' ];
}
protected function register_controls() {
$this->start_controls_section(
'prinox_info_option',
[
'label' => esc_html__( 'List Info Option', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'button_label', [
'label' => esc_html__( 'Button Label', 'prinox-tools' ),
'default' => esc_html__( 'Prinox Button', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_control(
'btn_link',
[
'label' => esc_html__( 'Button Link', 'textdomain' ),
'type' => \Elementor\Controls_Manager::URL,
'placeholder' => esc_html__( 'https://your-link.com', 'textdomain' ),
'options' => [ 'url', 'is_external', 'nofollow' ],
'default' => [
'url' => '',
'is_external' => true,
'nofollow' => true,
// 'custom_attributes' => '',
],
'label_block' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'project_info_style',
[
'label' => __( 'List Info Style', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'info_text_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Button Style', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_group_control(
\Elementor\Group_Control_Background::get_type(),
[
'name' => 'background',
'types' => [ 'gradient' ],
'selector' => '{{WRAPPER}} .btn-style-six',
]
);
$this->add_control(
'info_text_color',
[
'label' => esc_html__( 'Button Text Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn-style-six' => 'color: {{VALUE}} ',
],
]
);
$this->add_control(
'info_arr__color',
[
'label' => esc_html__( 'Button Arrow Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn-style-six .icon' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'info_text_typography',
'label' => esc_html__( 'Button Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .btn-style-six',
]
);
$this->add_control(
'btn_border_cl',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Button Border Style', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_group_control(
\Elementor\Group_Control_Border::get_type(),
[
'name' => 'border',
'selector' => '{{WRAPPER}} .btn-style-six',
]
);
$this->add_control(
'btn_hv_cl',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Button Hover', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'info_text_hover_color',
[
'label' => esc_html__( 'Button Text Hover Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn-style-six:hover span' => 'color: {{VALUE}}!important ',
],
]
);
$this->add_control(
'info_arr_hover_color',
[
'label' => esc_html__( 'Button Arrow Hover Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn-style-six:hover .icon' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'btn_hvbackground',
'types' => [ 'gradient' ],
'selector' => '{{WRAPPER}} .btn-style-six:before',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( ! empty( $settings['btn_link']['url'] ) ) {
$this->add_link_attributes( 'btn_link', $settings['btn_link'] );
}
?>
<div class="print-one_button-box">
<a <?php echo $this->get_render_attribute_string( 'btn_link' ); ?> class="theme-btn btn-style-six clearfix">
<span class="btn-wrap">
<span class="text-one"><?php echo wp_kses( $settings['button_label'], true );?></span>
<span class="text-two"><?php echo wp_kses( $settings['button_label'], true );?></span>
</span>
<span class="icon flaticon-right-arrow"></span>
</a>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register( new Prinox_Button() );