<?php
namespace Elementor;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Jet_Popup_Mailchimp extends Jet_Popup_Base {
/**
* Request config
*
* @var array
*/
public $config = array();
public function get_name() {
return 'jet-popup-mailchimp';
}
public function get_title() {
return esc_html__( 'Mailchimp', 'jet-popup' );
}
public function get_icon() {
return 'eicon-mailchimp';
}
public function get_categories() {
return array( 'jet-popup' );
}
protected function _register_controls() {
$css_scheme = apply_filters(
'jet-popup/mailchimp/css-scheme',
array(
'instance' => '.jet-popup-mailchimp',
'label' => '.jet-popup-mailchimp__field-label',
'input' => '.jet-popup-mailchimp__input',
'submit_container' => '.jet-popup-mailchimp__submit-container',
'submit' => '.jet-popup-mailchimp__submit',
'submit_icon' => '.jet-popup-mailchimp__submit-icon',
'message' => '.jet-popup-mailchimp__message',
)
);
$avaliable_lists = \Jet_Popup_Utils::get_avaliable_mailchimp_list();
if ( ! $avaliable_lists ) {
$this->start_controls_section(
'section_subscribe_error',
array(
'label' => esc_html__( 'Error', 'jet-popup' ),
)
);
$this->add_control(
'no_lists',
array(
'label' => false,
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->empty_lists_message(),
)
);
$this->end_controls_section();
return;
}
$this->start_controls_section(
'section_subscribe_settings',
array(
'label' => esc_html__( 'Settings', 'jet-popup' ),
)
);
$this->add_control(
'target_list_id',
[
'label' => esc_html__( 'List', 'jet-popup' ),
'type' => Controls_Manager::SELECT,
'default' => key( $avaliable_lists ),
'options' => $avaliable_lists
]
);
$this->add_control(
'use_redirect_url',
[
'label' => esc_html__( 'Use Redirect Url?', 'jet-popup' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'jet-popup' ),
'label_off' => esc_html__( 'No', 'jet-popup' ),
'return_value' => 'yes',
'default' => 'false',
]
);
$this->add_control(
'redirect_url',
array(
'label' => esc_html__( 'Redirect Url', 'jet-popup' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter Redirect Url', 'jet-popup' ),
'default' => '#',
'condition' => array(
'use_redirect_url' => 'yes',
),
)
);
$this->add_control(
'close_popup_when_success',
[
'label' => esc_html__( 'Close Popup When Success', 'jet-popup' ),
'description' => esc_html__( 'if the widget is in a popup, the successful response status will close the popup.', 'jet-popup' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'jet-popup' ),
'label_off' => esc_html__( 'No', 'jet-popup' ),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_subscribe_fields',
array(
'label' => esc_html__( 'Fields', 'jet-popup' ),
)
);
$this->add_control(
'email_label',
array(
'label' => esc_html__( 'E-Mail Label', 'jet-popup' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'E-Mail', 'jet-popup' ),
)
);
$this->add_control(
'email_placeholder',
array(
'label' => esc_html__( 'E-Mail Placeholder', 'jet-popup' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Enter E-Mail', 'jet-popup' ),
)
);
$this->add_responsive_control(
'email_field_size',
[
'label' => __( 'Email Size', 'jet-popup' ),
'type' => Controls_Manager::SELECT,
'options' => [
'100' => '100%',
'80' => '80%',
'75' => '75%',
'66' => '66%',
'60' => '60%',
'50' => '50%',
'40' => '40%',
'33' => '33%',
'25' => '25%',
'20' => '20%',
],
'default' => '100',
]
);
$this->add_control(
'use_additional_fields',
array(
'label' => esc_html__( 'Use Additional Fields', 'jet-popup' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'jet-popup' ),
'label_off' => esc_html__( 'No', 'jet-popup' ),
'return_value' => 'yes',
'default' => 'false',
'separator' => 'before',
)
);
$repeater = new Repeater();
$repeater->add_control(
'field_merge_tag',
[
'label' => esc_html__( 'Field Merge Tag', 'jet-popup' ),
'type' => Controls_Manager::TEXT,
'default' => '',
]
);
$repeater->add_control(
'field_merge_label',
[
'label' => esc_html__( 'Label', 'jet-popup' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Label', 'jet-popup' ),
]
);
$repeater->add_control(
'field_merge_placeholder',
[
'label' => esc_html__( 'Placeholder', 'jet-popup' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Placeholder', 'jet-popup' ),
]
);
$repeater->add_responsive_control(
'field_merge_width',
[
'label' => __( 'Column Width', 'jet-popup' ),
'type' => Controls_Manager::SELECT,
'options' => [
'100' => '100%',
'80' => '80%',
'75' => '75%',
'66' => '66%',
'60' => '60%',
'50' => '50%',
'40' => '40%',
'33' => '33%',
'25' => '25%',
'20' => '20%',
],
'default' => '100',
]
);
$this->add_control(
'additional_fields',
[
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
],
'title_field' => '{{{ field_merge_tag }}}',
'condition' => [
'use_additional_fields' => 'yes',
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_subscribe_submit',
array(
'label' => esc_html__( 'Submit Button', 'jet-popup' ),
)
);
$this->add_control(
'submit_button_text',
array(
'label' => esc_html__( 'Submit Text', 'jet-popup' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter Submit Button Text', 'jet-popup' ),
'default' => esc_html__( 'Subscribe', 'jet-popup' ),
)
);
$this->add_responsive_control(
'button_container_size',
[
'label' => __( 'Button Size', 'jet-popup' ),
'type' => Controls_Manager::SELECT,
'options' => [
'100' => '100%',
'80' => '80%',
'75' => '75%',
'66' => '66%',
'60' => '60%',
'50' => '50%',
'40' => '40%',
'33' => '33%',
'25' => '25%',
'20' => '20%',
],
'default' => '100',
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['submit_container'] => 'width: {{VALUE}}%;',
),
]
);
$this->add_responsive_control(
'button_alignment',
array(
'label' => esc_html__( 'Alignment', 'jet-popup' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'options' => array(
'flex-start' => array(
'title' => esc_html__( 'Left', 'jet-popup' ),
'icon' => 'fa fa-align-left',
),
'center' => array(
'title' => esc_html__( 'Center', 'jet-popup' ),
'icon' => 'fa fa-align-center',
),
'flex-end' => array(
'title' => esc_html__( 'Right', 'jet-popup' ),
'icon' => 'fa fa-align-right',
),
'stretch' => [
'title' => esc_html__( 'Justified', 'jet-popup' ),
'icon' => 'fa fa-align-justify',
]
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['submit_container'] => 'align-items: {{VALUE}};',
),
)
);
$this->end_controls_section();
/**
* General Style Section
*/
$this->start_controls_section(
'section_general_style',
array(
'label' => esc_html__( 'General', 'jet-popup' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
Loading ...