File: /home/pelakir/public_html/wp-content/plugins/digbuilder/includes/builder/document.php
<?php
if (!defined('ABSPATH')) {
exit;
}
class Digits_Elem_Document extends Elementor\Core\Base\Document
{
/**
* @access public
*/
public function get_name()
{
return 'digits-forms-popup';
}
/**
* @access public
* @static
*/
public static function get_title()
{
return esc_html__('Digits Popup', 'digbuilder');
}
/**
* [_register_controls description]
* @return [type] [description]
*/
protected function register_controls()
{
parent::register_controls();
$popup_id = '#digits-forms-popup-' . $this->get_main_id();
$this->register_popup_container_section($popup_id);
$this->register_popup_container_background_section($popup_id);
$this->register_popup_overlay_background_section($popup_id);
$this->register_close_button_section($popup_id);
$this->register_popup_advance_section($popup_id);
}
private function register_popup_container_section($popup_id)
{
$this->start_controls_section(
'digits_popup_style',
[
'label' => esc_html__('Popup Container', 'digbuilder'),
'tab' => Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'container_width',
[
'label' => esc_html__('Width', 'digbuilder'),
'type' => Elementor\Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 380,
'max' => 1200,
],
'em' => [
'min' => 30,
'max' => 100,
],
'%' => [
'min' => 1,
'max' => 100,
],
],
'default' => [
'size' => 450,
'unit' => 'px',
],
'selectors' => [
$popup_id . ' .digits-popup-container' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'container_custom_height',
[
'label' => esc_html__('Custom Height', 'digbuilder'),
'type' => Elementor\Controls_Manager::SWITCHER,
'label_on' => esc_html__('Yes', 'digbuilder'),
'label_off' => esc_html__('No', 'digbuilder'),
'return_value' => 'yes',
'default' => 'no',
]
);
$this->add_responsive_control(
'container_height',
[
'label' => esc_html__('Height', 'digbuilder'),
'type' => Elementor\Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 250,
'max' => 1200,
],
'em' => [
'min' => 18,
'max' => 100,
],
'%' => [
'min' => 1,
'max' => 100,
],
],
'default' => [
'size' => 500,
'unit' => 'px',
],
'selectors' => [
$popup_id . ' .digits-popup-container-child' => 'height: {{SIZE}}{{UNIT}};',
],
'condition' => [
'container_custom_height' => 'yes',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Border::get_type(),
[
'name' => 'container_border',
'label' => esc_html__('Border', 'digbuilder'),
'placeholder' => '1px',
'default' => '1px',
'selector' => $popup_id . ' .digits-popup-container-child',
'fields_options' => [
'width' => [
'label' => esc_html__('Border Width', 'digbuilder'),
],
'color' => [
'label' => esc_html__('Border Color', 'digbuilder'),
],
],
]
);
$this->add_control(
'container_border_radius',
[
'label' => esc_html__('Border Radius', 'digbuilder'),
'type' => Elementor\Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
$popup_id . ' .digits-popup-container-child' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
$popup_id . ' .digits-popup-container-background' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'container_shadow',
'selector' => $popup_id . ' .digits-popup-container-child',
]
);
$this->end_controls_section();
}
private function register_popup_container_background_section($popup_id)
{
$this->start_controls_section(
'digits_form_popup_container_background_style',
[
'label' => esc_html__('Popup Container Background', 'digbuilder'),
'tab' => Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Elementor\Group_Control_Background::get_type(),
[
'name' => 'container_background',
'selector' => $popup_id . ' .digits-popup-container-child',
]
);
$this->end_controls_section();
}
private function register_popup_overlay_background_section($popup_id)
{
$this->start_controls_section(
'digits_form_overlay_background_style',
[
'label' => esc_html__('Popup Overlay Background', 'digbuilder'),
'tab' => Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Elementor\Group_Control_Background::get_type(),
[
'name' => 'overlay_background',
'selector' => $popup_id . ' .digits-form-popup-background-overlay',
]
);
$this->end_controls_section();
}
private function register_close_button_section($popup_id)
{
$this->start_controls_section(
'digits_form_close_button_style',
[
'label' => esc_html__('Close Button', 'digbuilder'),
'tab' => Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'use_close_button',
[
'label' => esc_html__('Close Button', 'digbuilder'),
'type' => Elementor\Controls_Manager::SWITCHER,
'label_on' => esc_html__('Yes', 'digbuilder'),
'label_off' => esc_html__('No', 'digbuilder'),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->add_control(
'close_button_icon',
[
'label' => esc_html__('Icon', 'digbuilder'),
'type' => Elementor\Controls_Manager::ICONS,
'default' => [
'value' => 'fa fa-times',
'library' => 'solid',
],
]
);
$this->start_controls_tabs('close_button_style_tabs');
$this->start_controls_tab(
'close_button_control_normal_tab',
[
'label' => esc_html__('Normal', 'digbuilder'),
]
);
$this->add_group_control(
\Digits_Group_Control_Box_Style::get_type(),
[
'name' => 'close_button_box_style_normal',
'label' => esc_html__('Icon Styles', 'digbuilder'),
'selector' => $popup_id . ' .digits-popup-close-button',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'close_button_control_hover_tab',
[
'label' => esc_html__('Hover', 'digbuilder'),
]
);
$this->add_group_control(
\Digits_Group_Control_Box_Style::get_type(),
[
'name' => 'close_button_box_style_hover',
'label' => esc_html__('Icon Styles', 'digbuilder'),
'selector' => $popup_id . ' .digits-popup-close-button:hover',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
private function register_popup_advance_section($popup_id)
{
$this->register_advanced_section($popup_id);
$this->register_popup_positioning_section($popup_id);
$this->register_popup_motion_effects_section();
}
private function register_advanced_section($popup_id)
{
$this->start_controls_section(
'digits_popup_advanced',
[
'label' => esc_html__('Advanced', 'digbuilder'),
'tab' => Elementor\Controls_Manager::TAB_ADVANCED,
]
);
$this->add_responsive_control(
'container_margin',
[
'label' => esc_html__('Margin', 'digbuilder'),
'type' => Elementor\Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
$popup_id . ' .digits-popup-container-child' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'container_padding',
[
'label' => esc_html__('Padding', 'digbuilder'),
'type' => Elementor\Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
$popup_id . ' .digits-popup-container-child' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
}
private function register_popup_positioning_section($popup_id)
{
$this->start_controls_section(
'digits_popup_positioning_advanced',
[
'label' => esc_html__('Positioning', 'digbuilder'),
'tab' => Elementor\Controls_Manager::TAB_ADVANCED,
]
);
$this->add_responsive_control(
'digits_form_content_position',
[
'label' => esc_html__('Content Position', 'digbuilder'),
'type' => Elementor\Controls_Manager::CHOOSE,
'label_block' => false,
'default' => 'flex-start',
'options' => [
'flex-start' => [
'title' => esc_html__('Top', 'digbuilder'),
'icon' => 'eicon-v-align-top',
],
'center' => [
'title' => esc_html__('Middle', 'digbuilder'),
'icon' => 'eicon-v-align-middle',
],
'flex-end' => [
'title' => esc_html__('Bottom', 'digbuilder'),
'icon' => 'eicon-v-align-bottom',
],
],
'selectors' => [
$popup_id . ' .digits-popup-container' => 'justify-content: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'digits_form_horizontal_position',
[
'label' => esc_html__('Horizontal Position', 'digbuilder'),
'type' => Elementor\Controls_Manager::CHOOSE,
'default' => 'center',
'options' => [
'flex-start' => [
'title' => esc_html__('Left', 'digbuilder'),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__('Center', 'digbuilder'),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__('Right', 'digbuilder'),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
$popup_id . ' .digits-form-popup-box' => 'justify-content: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'digits_form_vertical_position',
[
'label' => esc_html__('Vertical Position', 'digbuilder'),
'type' => Elementor\Controls_Manager::CHOOSE,
'default' => 'center',
'options' => [
'flex-start' => [
'title' => esc_html__('Top', 'digbuilder'),
'icon' => 'eicon-v-align-top',
],
'center' => [
'title' => esc_html__('Middle', 'digbuilder'),
'icon' => 'eicon-v-align-middle',
],
'flex-end' => [
'title' => esc_html__('Bottom', 'digbuilder'),
'icon' => 'eicon-v-align-bottom',
],
],
'selectors' => [
$popup_id . ' .digits-form-popup-box' => 'align-items: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
private function register_popup_motion_effects_section()
{
$this->start_controls_section(
'digits_popup_motion_effects_advanced',
[
'label' => esc_html__('Motion Effects', 'digbuilder'),
'tab' => Elementor\Controls_Manager::TAB_ADVANCED,
]
);
$this->add_control(
'entrance_animation',
[
'label' => esc_html__('Entrance', 'digbuilder'),
'type' => \Elementor\Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'entrance_animation_type',
[
'label' => esc_html__('Animation', 'digbuilder'),
'type' => Elementor\Controls_Manager::SELECT,
'default' => 'fadeIn',
'options' => [
'bounce' => esc_html__('bounce', 'digbuilder'),
'flash' => esc_html__('flash', 'digbuilder'),
'pulse' => esc_html__('pulse', 'digbuilder'),
'rubberBand' => esc_html__('rubberBand', 'digbuilder'),
'shake' => esc_html__('shake', 'digbuilder'),
'swing' => esc_html__('swing', 'digbuilder'),
'tada' => esc_html__('tada', 'digbuilder'),
'wobble' => esc_html__('wobble', 'digbuilder'),
'jello' => esc_html__('jello', 'digbuilder'),
'heartBeat' => esc_html__('heartBeat', 'digbuilder'),
'bounceIn' => esc_html__('bounceIn', 'digbuilder'),
'bounceInDown' => esc_html__('bounceInDown', 'digbuilder'),
'bounceInLeft' => esc_html__('bounceInLeft', 'digbuilder'),
'bounceInRight' => esc_html__('bounceInRight', 'digbuilder'),
'bounceInUp' => esc_html__('bounceInUp', 'digbuilder'),
'fadeIn' => esc_html__('fadeIn', 'digbuilder'),
'fadeInDown' => esc_html__('fadeInDown', 'digbuilder'),
'fadeInDownBig' => esc_html__('fadeInDownBig', 'digbuilder'),
'fadeInLeft' => esc_html__('fadeInLeft', 'digbuilder'),
'fadeInLeftBig' => esc_html__('fadeInLeftBig', 'digbuilder'),
'fadeInRight' => esc_html__('fadeInRight', 'digbuilder'),
'fadeInRightBig' => esc_html__('fadeInRightBig', 'digbuilder'),
'fadeInUp' => esc_html__('fadeInUp', 'digbuilder'),
'fadeInUpBig' => esc_html__('fadeInUpBig', 'digbuilder'),
'flip' => esc_html__('flip', 'digbuilder'),
'flipInX' => esc_html__('flipInX', 'digbuilder'),
'flipInY' => esc_html__('flipInY', 'digbuilder'),
'lightSpeedIn' => esc_html__('lightSpeedIn', 'digbuilder'),
'rotateIn' => esc_html__('rotateIn', 'digbuilder'),
'rotateInDownLeft' => esc_html__('rotateInDownLeft', 'digbuilder'),
'rotateInDownRight' => esc_html__('rotateInDownRight', 'digbuilder'),
'rotateInUpLeft' => esc_html__('rotateInUpLeft', 'digbuilder'),
'rotateInUpRight' => esc_html__('rotateInUpRight', 'digbuilder'),
'slideInUp' => esc_html__('slideInUp', 'digbuilder'),
'slideInDown' => esc_html__('slideInDown', 'digbuilder'),
'slideInLeft' => esc_html__('slideInLeft', 'digbuilder'),
'slideInRight' => esc_html__('slideInRight', 'digbuilder'),
'zoomIn' => esc_html__('zoomIn', 'digbuilder'),
'zoomInDown' => esc_html__('zoomInDown', 'digbuilder'),
'zoomInLeft' => esc_html__('zoomInLeft', 'digbuilder'),
'zoomInRight' => esc_html__('zoomInRight', 'digbuilder'),
'zoomInUp' => esc_html__('zoomInUp', 'digbuilder'),
'jackInTheBox' => esc_html__('jackInTheBox', 'digbuilder'),
'rollIn' => esc_html__('rollIn', 'digbuilder'),
],
]
);
$this->add_control(
'entrance_animation_speed',
[
'label' => esc_html__('Animation Speed', 'digbuilder'),
'type' => Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => [
'faster' => esc_html__('Faster', 'digbuilder'),
'fast' => esc_html__('Fast', 'digbuilder'),
'' => esc_html__('Normal', 'digbuilder'),
'slow' => esc_html__('Slow', 'digbuilder'),
'slower' => esc_html__('Slower', 'digbuilder'),
],
]
);
$this->end_controls_section();
}
}