/home/nbcgowuy/kdosheleads.com/wp-content/themes/marketo/inc/shortcode/xs-button.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit;
class Xs_Button_Widget extends Widget_Base {
public function get_name() {
return 'xs-button';
}
public function get_title() {
return esc_html__( 'Marketo Button', 'marketo' );
}
public function get_icon() {
return 'eicon-button';
}
public function get_categories() {
return [ 'marketo-elements' ];
}
protected function register_controls() {
$this->start_controls_section(
'section_tab',
[
'label' =>esc_html__('Marketo Button', 'marketo'),
]
);
$this->add_control(
'btn_text',
[
'label' =>esc_html__( 'Label', 'marketo' ),
'type' => Controls_Manager::TEXT,
'default' =>esc_html__( 'Learn more ', 'marketo' ),
'placeholder' =>esc_html__( 'Learn more ', 'marketo' ),
]
);
$this->add_control(
'btn_link',
[
'label' =>esc_html__( 'Link', 'marketo' ),
'type' => Controls_Manager::URL,
'placeholder' =>esc_html__('http://your-link.com','marketo' ),
'default' => [
'url' => '#',
],
]
);
$this->add_responsive_control(
'btn_align',
[
'label' =>esc_html__( 'Alignment', 'marketo' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' =>esc_html__( 'Left', 'marketo' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' =>esc_html__( 'Center', 'marketo' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' =>esc_html__( 'Right', 'marketo' ),
'icon' => 'fa fa-align-right',
],
],
'prefix_class' => 'elementor%s-align-',
'default' => '',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_style',
[
'label' =>esc_html__( 'Button Style', 'marketo' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'boder_width',
[
'label' =>esc_html__( 'Border Width', 'marketo' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px'],
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0 ,
'left' => 0,
],
'selectors' => [
'{{WRAPPER}} .btn-primary' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};border-style: solid;',
],
]
);
$this->add_responsive_control(
'btn_border_radius',
[
'label' =>esc_html__( 'Border Radius', 'marketo' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px'],
'default' => [
'top' => '',
'right' => '',
'bottom' => '' ,
'left' => '',
],
'selectors' => [
'{{WRAPPER}} .btn-primary' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'btn_padding',
[
'label' =>esc_html__( 'Padding', 'marketo' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px'],
'default' => [
'top' => '',
'right' => '',
'bottom' => '' ,
'left' => '',
],
'selectors' => [
'{{WRAPPER}} .btn-primary' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'btn_typography',
'label' =>esc_html__( 'Typography', 'marketo' ),
'selector' => '{{WRAPPER}} a.btn-primary',
]
);
$this->start_controls_tabs( 'xs_tabs_button_style' );
$this->start_controls_tab(
'tab_button_normal',
[
'label' =>esc_html__( 'Normal', 'marketo' ),
]
);
$this->add_control(
'btn_text_color',
[
'label' =>esc_html__( 'Text Color', 'marketo' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} a.btn-primary' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'btn_bg_color',
[
'label' =>esc_html__( 'Background Color', 'marketo' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} a.btn-primary' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'border_color', [
'label' =>esc_html__( 'Border color', 'marketo' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn-primary' => 'border-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'btn_tab_button_hover',
[
'label' =>esc_html__( 'Hover', 'marketo' ),
]
);
$this->add_control(
'btn_hover_color',
[
'label' =>esc_html__( 'Text Color', 'marketo' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} a.btn-primary:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'btn_bg_hover_color',
[
'label' =>esc_html__( 'Background Color', 'marketo' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn-primary:before' => 'border-bottom: 100px solid {{VALUE}};',
'{{WRAPPER}} .btn-primary:after' => 'border-top: 100px solid {{VALUE}};',
'{{WRAPPER}} .btn-primary::before' => 'background-color:{{VALUE}};',
],
]
);
$this->add_control(
'btn_hover_border_color',
[
'label' =>esc_html__( 'Border Color', 'marketo' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} a.btn-primary:hover' => 'border-color: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
protected function render( ) {
$settings = $this->get_settings();
$btn_text = $settings['btn_text'];
$btn_link = (! empty( $settings['btn_link']['url'])) ? $settings['btn_link']['url'] : '';
$btn_target = ( $settings['btn_link']['is_external']) ? '_blank' : '_self';
?>
<?php if(!empty($btn_text)): ?>
<a href="<?php echo esc_url( $btn_link ); ?>" target="<?php echo esc_html( $btn_target ); ?>" class="btn btn-primary">
<?php echo esc_html( $btn_text ); ?>
</a>
<?php endif; ?>
<?php
}
protected function content_template() { }
}