* @link https://www.elicus.com/
* @copyright 2023 Elicus Technologies Private Limited
* @version 1.9.15
*/
class DIPL_Modal extends ET_Builder_Module {
public $slug = 'dipl_modal';
public $vb_support = 'on';
protected $module_credits = array(
'module_uri' => 'https://diviextended.com/product/divi-plus/',
'author' => 'Elicus',
'author_uri' => 'https://elicus.com/',
);
public function init() {
$this->name = esc_html__( 'DP Modal', 'divi-plus' );
$this->main_css_element = '%%order_class%%';
}
public function get_settings_modal_toggles() {
return array(
'general' => array(
'toggles' => array(
'main_content' => esc_html__( 'Configuration', 'divi-plus' ),
'modal_header' => esc_html__( 'Modal Header', 'divi-plus' ),
'modal_body' => esc_html__( 'Modal Body', 'divi-plus' ),
'modal_footer' => esc_html__( 'Modal Footer', 'divi-plus' ),
'scroll_settings' => esc_html__( 'Scroll Settings', 'divi-plus' ),
'background' => esc_html__( 'Background', 'divi-plus' ),
),
),
'advanced' => array(
'toggles' => array(
'text' => esc_html__( 'Alignment', 'divi-plus' ),
'trigger_button' => esc_html__( 'Trigger Button', 'divi-plus' ),
'trigger_text' => esc_html__( 'Trigger Text', 'divi-plus' ),
'trigger_icon' => esc_html__( 'Trigger Icon', 'divi-plus' ),
'trigger_image' => esc_html__( 'Trigger Image', 'divi-plus' ),
'modal_title_text' => esc_html__( 'Modal Title Text', 'divi-plus' ),
'modal_body_text' => esc_html__( 'Modal Body Text', 'divi-plus' ),
'modal_close_icon' => esc_html__( 'Modal Close Icon', 'divi-plus' ),
'modal_close_button' => esc_html__( 'Modal Close Button', 'divi-plus' ),
'box_shadow' => esc_html__( 'Box Shadow', 'divi-plus' ),
'border' => esc_html__( 'Border', 'divi-plus' ),
'modal_sizing' => esc_html__( 'Modal Sizing & Alignment', 'divi-plus' ),
),
),
);
}
public function get_advanced_fields_config() {
return array(
'fonts' => array(
'modal_title_text' => array(
'label' => esc_html__( 'Modal Title', 'divi-plus' ),
'font_size' => array(
'default' => '20px',
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
'validate_unit' => true,
),
'line_height' => array(
'default' => '1.5em',
'range_settings' => array(
'min' => '0.1',
'max' => '10',
'step' => '0.1',
),
),
'letter_spacing' => array(
'default' => '0px',
'range_settings' => array(
'min' => '0',
'max' => '10',
'step' => '1',
),
'validate_unit' => true,
),
'header_level' => array(
'default' => 'h2',
),
'text_align' => array(
'default' => 'left',
),
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_header_title",
'hover' => "{$this->main_css_element}_module .dipl_modal_header_title:hover",
'text_align' => "{$this->main_css_element}_module .dipl_modal_header_title_container",
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_title_text',
),
'modal_body_text' => array(
'label' => esc_html__( 'Modal Body', 'divi-plus' ),
'font_size' => array(
'default' => '14px',
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
'validate_unit' => true,
),
'line_height' => array(
'default' => '1.5em',
'range_settings' => array(
'min' => '0.1',
'max' => '10',
'step' => '0.1',
),
),
'letter_spacing' => array(
'default' => '0px',
'range_settings' => array(
'min' => '0',
'max' => '10',
'step' => '1',
),
'validate_unit' => true,
),
'text_align' => array(
'default' => 'left',
),
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_body",
'hover' => "{$this->main_css_element}_module .dipl_modal_body:hover",
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_body_text',
),
'modal_trigger_text' => array(
'label' => esc_html__( 'Trigger Text', 'divi-plus' ),
'font_size' => array(
'default' => '18px',
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
'validate_unit' => true,
),
'line_height' => array(
'default' => '1.5em',
'range_settings' => array(
'min' => '0.1',
'max' => '10',
'step' => '0.1',
),
),
'letter_spacing' => array(
'default' => '0px',
'range_settings' => array(
'min' => '0',
'max' => '10',
'step' => '1',
),
'validate_unit' => true,
),
'hide_text_align' => true,
'css' => array(
'main' => "{$this->main_css_element} .dipl_modal_trigger_text",
'hover' => "{$this->main_css_element} .dipl_modal_trigger_text:hover",
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'trigger_text',
),
),
'button' => array(
'trigger_button' => array(
'label' => esc_html__( 'Trigger Button', 'divi-plus' ),
'css' => array(
'main' => "{$this->main_css_element} .dipl_modal_trigger_button",
'alignment' => "{$this->main_css_element} .dipl_modal_trigger_element_wrapper .et_pb_button_wrapper",
'important' => 'all',
),
'margin_padding' => array(
'css' => array(
'margin' => "{$this->main_css_element} .dipl_modal_trigger_element_wrapper .et_pb_button_wrapper",
'padding' => "{$this->main_css_element} .dipl_modal_trigger_button, {$this->main_css_element} .dipl_modal_trigger_button:hover",
'important' => 'all',
),
),
'box_shadow' => array(
'css' => array(
'main' => "{$this->main_css_element} .dipl_modal_trigger_button",
'important' => 'all',
),
),
'use_alignment' => false,
'tab_slug' => 'advanced',
'toggle_slug' => 'trigger_button',
),
'close_button' => array(
'label' => esc_html__( 'Close Button', 'divi-plus' ),
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_close_button",
'alignment' => "{$this->main_css_element}_module .dipl_modal_footer .et_pb_button_wrapper",
'important' => 'all',
),
'margin_padding' => array(
'css' => array(
'margin' => "{$this->main_css_element}_module .dipl_modal_footer .et_pb_button_wrapper",
'padding' => "{$this->main_css_element}_module .dipl_modal_close_button, {$this->main_css_element}_module .dipl_modal_close_button:hover",
'important' => 'all',
),
),
'box_shadow' => array(
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_close_button",
'important' => 'all',
),
),
'use_alignment' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_close_button',
),
),
'borders' => array(
'default' => false,
'trigger_element' => array(
'label_prefix' => 'Trigger Element',
'css' => array(
'main' => array(
'border_radii' => "{$this->main_css_element} .dipl_modal_trigger_element_wrapper .dipl_modal_trigger_element",
'border_styles' => "{$this->main_css_element} .dipl_modal_trigger_element_wrapper .dipl_modal_trigger_element",
),
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'border',
),
'modal' => array(
'label_prefix' => 'Modal',
'css' => array(
'main' => array(
'border_radii' => "{$this->main_css_element}_module .dipl_modal_inner_wrap",
'border_styles' => "{$this->main_css_element}_module .dipl_modal_inner_wrap",
),
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'border',
),
),
'box_shadow' => array(
'default' => false,
'trigger_element' => array(
'label' => esc_html__( 'Trigger Element Box Shadow', 'divi-plus' ),
'css' => array(
'main' => "{$this->main_css_element} .dipl_modal_trigger_element",
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'box_shadow',
),
'modal' => array(
'label' => esc_html__( 'Modal Box Shadow', 'divi-plus' ),
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_inner_wrap",
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'box_shadow',
),
'modal_header' => array(
'label' => esc_html__( 'Modal Header Box Shadow', 'divi-plus' ),
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_header",
'important' => 'all',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'box_shadow',
),
'modal_footer' => array(
'label' => esc_html__( 'Modal Footer Box Shadow', 'divi-plus' ),
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_footer",
'important' => 'all',
),
'priority' => 0,
'tab_slug' => 'advanced',
'toggle_slug' => 'box_shadow',
),
),
'max_width' => array(
'extra' => array(
'modal' => array(
'options' => array(
'width' => array(
'label' => esc_html__( 'Modal Width', 'divi-plus' ),
'range_settings' => array(
'min' => 1,
'max' => 100,
'step' => 1,
),
'hover' => false,
'default_unit' => '%',
'default_tablet' => '',
'default_phone' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_sizing',
),
),
'use_max_width' => false,
'use_module_alignment' => false,
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_inner_wrap",
'important' => 'all',
),
),
'trigger_image' => array(
'options' => array(
'width' => array(
'label' => esc_html__( 'Image Width', 'divi-plus' ),
'range_settings' => array(
'min' => 1,
'max' => 100,
'step' => 1,
),
'hover' => false,
'default_unit' => '%',
'default_tablet' => '',
'default_phone' => '',
'show_if' => array(
'trigger_element_type' => 'image',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'trigger_image',
),
),
'use_max_width' => false,
'use_module_alignment' => false,
'css' => array(
'main' => "{$this->main_css_element} .dipl_modal_trigger_image",
'important' => 'all',
),
),
),
),
'height' => array(
'extra' => array(
'modal' => array(
'options' => array(
'height' => array(
'label' => esc_html__( 'Modal Height', 'divi-plus' ),
'range_settings' => array(
'min' => 1,
'max' => 100,
'step' => 1,
),
'hover' => false,
'default_unit' => '%',
'default_tablet' => '',
'default_phone' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_sizing',
),
),
'use_max_height' => false,
'use_min_height' => false,
'css' => array(
'main' => "{$this->main_css_element}_module .dipl_modal_inner_wrap",
'important' => 'all',
),
),
),
),
'text' => array(
'text_orientation' => array(
'exclude_options' => array( 'justified' ),
),
'options' => array(
'text_orientation' => array(
'label' => esc_html__( 'Trigger Element Alignment', 'divi-plus' ),
),
),
'css' => array(
'text_orientation' => $this->main_css_element,
),
),
'modal_margin_padding' => array(
'modal' => array(
'margin_padding' => array(
'css' => array(
'margin' => "{$this->main_css_element}_module .dipl_modal_inner_wrap",
'padding' => "{$this->main_css_element}_module .dipl_modal_inner_wrap",
'important' => 'all',
),
),
),
'modal_header' => array(
'margin_padding' => array(
'css' => array(
'margin' => "{$this->main_css_element}_module .dipl_modal_header",
'padding' => "{$this->main_css_element}_module .dipl_modal_header",
'important' => 'all',
),
),
),
'modal_body' => array(
'margin_padding' => array(
'css' => array(
'margin' => "{$this->main_css_element}_module .dipl_modal_body",
'padding' => "{$this->main_css_element}_module .dipl_modal_body",
'important' => 'all',
),
),
),
'modal_footer' => array(
'margin_padding' => array(
'css' => array(
'margin' => "{$this->main_css_element}_module .dipl_modal_footer",
'padding' => "{$this->main_css_element}_module .dipl_modal_footer",
'important' => 'all',
),
),
),
),
'margin_padding' => array(
'css' => array(
'main' => $this->main_css_element,
'important' => 'all',
),
),
'text_shadow' => false,
'link_options' => false,
'filters' => false,
'background' => false,
);
}
public function get_fields() {
$query_args = array(
'post_type' => 'et_pb_layout',
'posts_per_page' => -1,
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => '_et_pb_predefined_layout',
'value' => 'on',
'compare' => 'NOT EXISTS',
),
),
);
$layout_list = array();
$layout_list[0] = esc_html__( 'Select', 'divi-plus' );
$library_layouts = get_posts($query_args);
if ( $library_layouts ) {
foreach ( $library_layouts as $library_layout ) {
$post_id = $library_layout->ID;
$post_title = $library_layout->post_title;
$layout_list[$post_id] = $post_title;
}
}
$et_accent_color = et_builder_accent_color();
return array_merge(
array(
'modal_id_notice' => array(
'label' => '',
'type' => 'warning',
'option_category' => 'configuration',
'value' => true,
'display_if' => true,
'message' => esc_html__( 'In order to make the modal work perfectly, please enter a unique ID for it.', 'divi-plus' ),
'show_if' => array(
'modal_id' => array( '' ),
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
),
'modal_id' => array(
'label' => esc_html__( 'Unique Modal ID', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'default' => '',
'default_on_front' => '',
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Enter a unique ID for the modal to make it work perfectly.', 'divi-plus' ),
),
'trigger_type' => array(
'label' => esc_html__( 'Trigger Type', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'element' => esc_html__( 'Element', 'divi-plus' ),
'on_page_load' => esc_html__( 'On Page Load', 'divi-plus' ),
'exit_intent' => esc_html__( 'Exit Intent', 'divi-plus' ),
),
'default' => 'element',
'default_on_front' => 'element',
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can select how you want to activate modal on the page.', 'divi-plus' ),
),
'trigger_delay' => array(
'label' => esc_html__( 'Trigger Delay', 'divi-plus' ),
'type' => 'range',
'option_category' => 'layout',
'range_settings' => array(
'min' => '100',
'max' => '15000',
'step' => '100',
),
'validate_unit' => true,
'fixed_unit' => 'ms',
'fixed_range' => true,
'default' => '3000ms',
'default_on_front' => '3000ms',
'show_if' => array(
'trigger_type' => 'on_page_load',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Move the slider or input the value to apply delay in activating the modal.', 'divi-plus'),
),
're_rendering' => array(
'label' => esc_html__( 'Re-render modal on reloading/revisiting the page', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'on',
'default_on_front' => 'on',
'show_if' => array(
'trigger_type' => 'on_page_load',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can choose whether to re-render modal on reload or revisiting the page after user closed the modal.', 'divi-plus'),
),
'trigger_element_type' => array(
'label' => esc_html__( 'Trigger Element Type', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'button' => esc_html__( 'Button', 'divi-plus' ),
'image' => esc_html__( 'Image', 'divi-plus' ),
'icon' => esc_html__( 'Icon', 'divi-plus' ),
'text' => esc_html__( 'Text', 'divi-plus' ),
'element_id' => esc_html__( 'Element CSS ID', 'divi-plus' ),
'element_class' => esc_html__( 'Element CSS Class', 'divi-plus' ),
),
'default' => 'button',
'default_on_front' => 'button',
'show_if' => array(
'trigger_type' => 'element',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can select the trigger element you want to use for activating the modal.', 'divi-plus'),
),
'trigger_element_id' => array(
'label' => esc_html__( 'Element CSS ID', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'element_id',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can input the CSS ID(without #) of the element to be used as a trigger for activating the modal.', 'divi-plus'),
),
'trigger_element_class' => array(
'label' => esc_html__( 'Element CSS Class', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'element_class',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can input the CSS Class(without .) of the element to be used as a trigger for activating the modal.', 'divi-plus'),
),
'trigger_button_text' => array(
'label' => esc_html__( 'Button Text', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'default' => 'Click Me',
'default_on_front' => 'Click Me',
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'button',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can input the text to be used for the button of modal trigger.', 'divi-plus'),
),
'trigger_icon' => array(
'label' => esc_html__( 'Icon', 'divi-plus' ),
'type' => 'select_icon',
'option_category' => 'button',
'class' => array( 'et-pb-font-icon' ),
'default' => ET_BUILDER_PRODUCT_VERSION < '4.13.0' ? '%%40%%' : 'I||divi||400',
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'icon',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can select an icon to be used for the modal trigger.', 'divi-plus'),
),
'trigger_image' => array(
'label' => esc_html__( 'Image', 'divi-plus' ),
'type' => 'upload',
'option_category' => 'basic_option',
'upload_button_text' => esc_attr__( 'Upload an image', 'divi-plus' ),
'choose_text' => esc_attr__( 'Choose an Image', 'divi-plus' ),
'update_text' => esc_attr__( 'Set As Image', 'divi-plus' ),
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'image',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can add an image to be used for the modal trigger.', 'divi-plus'),
),
'trigger_image_alt' => array(
'label' => esc_html__( 'Image Alternative Text', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'image',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can input the text to be used for the image of modal trigger as alternative text.', 'divi-plus'),
),
'trigger_text' => array(
'label' => esc_html__( 'Text', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'default' => 'Enter modal trigger text here',
'default_on_front' => 'Enter modal trigger text here',
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'text',
),
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can input the text to be used as modal trigger.', 'divi-plus'),
),
'close_on_esc' => array(
'label' => esc_html__( 'Close Modal On ESC', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'off',
'default_on_front' => 'off',
'tab_slug' => 'general',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can choose whether or not to close the modal on ESC key.', 'divi-plus'),
),
'show_header' => array(
'label' => esc_html__( 'Show Header', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'on',
'default_on_front' => 'on',
'tab_slug' => 'general',
'toggle_slug' => 'modal_header',
'description' => esc_html__( 'Here you can choose whether or not to display header with modal.', 'divi-plus'),
),
'show_modal_title' => array(
'label' => esc_html__( 'Show Modal Title', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'on',
'default_on_front' => 'on',
'show_if' => array(
'show_header' => 'on',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_header',
'description' => esc_html__( 'Here you can choose whether or not to display title on the modal.', 'divi-plus')
),
'modal_title' => array(
'label' => esc_html__( 'Modal Title', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'dynamic_content' => 'text',
'show_if' => array(
'show_header' => 'on',
'show_modal_title' => 'on',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_header',
'description' => esc_html__( 'Here you can input the text to be used for the modal title.', 'divi-plus')
),
'show_close_icon' => array(
'label' => esc_html__( 'Show Close Icon', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'on',
'default_on_front' => 'on',
'show_if' => array(
'show_header' => 'on',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_header',
'description' => esc_html__( 'Here you can choose whether or not to display close icon on the modal.', 'divi-plus')
),
'show_footer' => array(
'label' => esc_html__( 'Show Footer', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'on',
'default_on_front' => 'on',
'tab_slug' => 'general',
'toggle_slug' => 'modal_footer',
'description' => esc_html__( 'Here you can choose whether or not to display footer with modal.', 'divi-plus'),
),
'close_button_text' => array(
'label' => esc_html__( 'Close Button Text', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'default' => 'Close',
'default_on_front' => 'Close',
'show_if' => array(
'show_footer' => 'on',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_footer',
'description' => esc_html__( 'Here you can input the text to be used for the modal close button.', 'divi-plus'),
),
'modal_content_type' => array(
'label' => esc_html__( 'Modal Content Type', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'text' => esc_html__( 'Text', 'divi-plus' ),
'image' => esc_html__( 'Image', 'divi-plus' ),
'video' => esc_html__( 'Video', 'divi-plus' ),
'layout' => esc_html__( 'Divi Library Layout', 'divi-plus' ),
),
'default' => 'text',
'default_on_front' => 'text',
'tab_slug' => 'general',
'toggle_slug' => 'modal_body',
'description' => esc_html__( 'Here you can choose what type of content you want to display inside modal body.', 'divi-plus'),
),
'content' => array(
'label' => esc_html__( 'Text', 'divi-plus' ),
'type' => 'tiny_mce',
'option_category' => 'basic_option',
'dynamic_content' => 'text',
'show_if' => array(
'modal_content_type' => 'text',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_body',
'description' => esc_html__( 'Here you can input the text to be used for the modal content.', 'divi-plus'),
),
'modal_content_image' => array(
'label' => esc_html__( 'Image', 'divi-plus' ),
'type' => 'upload',
'option_category' => 'basic_option',
'upload_button_text' => esc_attr__( 'Upload an image', 'divi-plus' ),
'choose_text' => esc_attr__( 'Choose an Image', 'divi-plus' ),
'update_text' => esc_attr__( 'Set As Image', 'divi-plus' ),
'show_if' => array(
'modal_content_type' => 'image',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_body',
'description' => esc_html__( 'Here you can add an image to be used for the modal content.', 'divi-plus'),
),
'modal_content_image_alt' => array(
'label' => esc_html__( 'Image Alternative Text', 'divi-plus' ),
'type' => 'text',
'option_category' => 'basic_option',
'show_if' => array(
'modal_content_type' => 'image',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_body',
'description' => esc_html__( 'Here you can input the text to be used for the modal content image as alternative text.', 'divi-plus'),
),
'modal_content_video' => array(
'label' => esc_html__( 'Video MP4 File Or URL', 'divi-plus' ),
'type' => 'upload',
'option_category' => 'basic_option',
'data_type' => 'video',
'upload_button_text' => esc_attr__( 'Upload a video', 'divi-plus' ),
'choose_text' => esc_attr__( 'Choose a Video MP4 File', 'divi-plus' ),
'update_text' => esc_attr__( 'Set As Video', 'divi-plus' ),
'show_if' => array(
'modal_content_type' => 'video',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_body',
'description' => esc_html__( 'Upload your desired video in .MP4 format, or enter in the URL of the video you would like to display inside modal content.', 'divi-plus' ),
),
'autoplay_video' => array(
'label' => esc_html__( 'Autoplay Video', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'off',
'default_on_front' => 'off',
'show_if' => array(
'modal_content_type' => 'video',
),
'tab_slug' => 'general',
'toggle_slug' => 'modal_body',
'description' => esc_html__( 'Here you can choose whether or not to autoplay video. We can not guarantee autoplay for all platforms video. Videos which support \'autoplay=1\' in their url structure can be autoplayed eg. YouTube, Vimeo. Videos uploaded in media library can be supported.', 'divi-plus'),
),
'modal_content_layout' => array(
'label' => esc_html__( 'Divi Library Layout', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => $layout_list,
'show_if' => array(
'modal_content_type' => 'layout',
),
'default' => '0',
'default_on_front' => '0',
'tab_slug' => 'general',
'toggle_slug' => 'modal_body',
'description' => esc_html__( 'Here you can select the layouts saved in your Divi library to be used for the modal content.', 'divi-plus' ),
),
'disable_website_scroll' => array(
'label' => esc_html__( 'Disable Website scroll', 'divi-plus' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => esc_html__( 'No', 'divi-plus' ),
'on' => esc_html__( 'Yes', 'divi-plus' ),
),
'default' => 'on',
'tab_slug' => 'general',
'toggle_slug' => 'scroll_settings',
'description' => esc_html__( 'Here you can select whether to disable webpage scroll when the modal pops up.', 'divi-plus' ),
),
'modal_body_scrollbar' => array(
'label' => esc_html__( 'Modal Scrollbar', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'default' => esc_html__( 'Show', 'divi-plus' ),
'hide' => esc_html__( 'Hide', 'divi-plus' ),
),
'default' => 'default',
'tab_slug' => 'general',
'toggle_slug' => 'scroll_settings',
'description' => esc_html__( 'Here you can select whether to show or hide scrollbar. This is totally depends on the browser, we can not guarantee the result of it.', 'divi-plus' ),
),
'trigger_icon_font_size' => array(
'label' => esc_html__( 'Trigger Icon Font Size', 'divi-plus' ),
'type' => 'range',
'option_category' => 'font_option',
'range_settings' => array(
'min' => '1',
'max' => '120',
'step' => '1',
),
'default' => '52px',
'default_on_front' => '52px',
'mobile_options' => true,
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'icon',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'trigger_icon',
'description' => esc_html__( 'Move the slider or input the value to increase or decrease trigger icon size.', 'divi-plus' ),
),
'trigger_icon_color' => array(
'label' => esc_html__( 'Trigger Icon Color', 'divi-plus' ),
'type' => 'color-alpha',
'default' => $et_accent_color,
'default_on_front' => $et_accent_color,
'show_if' => array(
'trigger_type' => 'element',
'trigger_element_type' => 'icon',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'trigger_icon',
'description' => esc_html__( 'Here you can define a custom color to be used for the trigger icon.', 'divi-plus' ),
),
'modal_custom_margin' => array(
'label' => esc_html__( 'Modal Margin', 'divi-plus' ),
'type' => 'custom_margin',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '',
'default_on_front' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the element and other items on the page.', 'divi-plus' ),
),
'modal_custom_padding' => array(
'label' => esc_html__( 'Modal Padding', 'divi-plus' ),
'type' => 'custom_padding',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '',
'default_on_front' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'divi-plus' ),
),
'modal_header_custom_margin' => array(
'label' => esc_html__( 'Modal Header Margin', 'divi-plus' ),
'type' => 'custom_margin',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '',
'default_on_front' => '',
'show_if' => array(
'show_header' => 'on',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the element and other items on the page.', 'divi-plus' ),
),
'modal_header_custom_padding' => array(
'label' => esc_html__( 'Modal Header Padding', 'divi-plus' ),
'type' => 'custom_padding',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '20px|20px|20px|20px|true|true',
'default_on_front' => '20px|20px|20px|20px|true|true',
'show_if' => array(
'show_header' => 'on',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'divi-plus' ),
),
'modal_body_custom_margin' => array(
'label' => esc_html__( 'Modal Body Margin', 'divi-plus' ),
'type' => 'custom_margin',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '',
'default_on_front' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the element and other items on the page.', 'divi-plus' ),
),
'modal_body_custom_padding' => array(
'label' => esc_html__( 'Modal Body Padding', 'divi-plus' ),
'type' => 'custom_padding',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '20px|20px|20px|20px|true|true',
'default_on_front' => '20px|20px|20px|20px|true|true',
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'divi-plus' ),
),
'modal_footer_custom_margin' => array(
'label' => esc_html__( 'Modal Footer Margin', 'divi-plus' ),
'type' => 'custom_margin',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '',
'default_on_front' => '',
'show_if' => array(
'show_footer' => 'on',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the element and other items on the page.', 'divi-plus' ),
),
'modal_footer_custom_padding' => array(
'label' => esc_html__( 'Modal Footer Padding', 'divi-plus' ),
'type' => 'custom_padding',
'option_category' => 'layout',
'mobile_options' => true,
'default' => '20px|20px|20px|20px|true|true',
'default_on_front' => '20px|20px|20px|20px|true|true',
'show_if' => array(
'show_footer' => 'on',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'margin_padding',
'description' => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'divi-plus' ),
),
'trigger_element_bg_color' => array(
'label' => esc_html__( 'Trigger Element Background', 'divi-plus' ),
'type' => 'background-field',
'base_name' => 'trigger_element_bg',
'context' => 'trigger_element_bg_color',
'option_category' => 'button',
'custom_color' => true,
'background_fields' => $this->generate_background_options( 'trigger_element_bg', 'button', 'general', 'background', 'trigger_element_bg_color' ),
'hover' => false,
'mobile_options' => true,
'show_if_not' => array(
'trigger_element_type' => 'element_id',
'trigger_type' => 'on_page_load',
),
'tab_slug' => 'general',
'toggle_slug' => 'background',
'description' => esc_html__( 'Customize the background of the Trigger Element by adjusting background color, gradient, and image.', 'divi-plus' ),
),
'modal_overlay_bg_color' => array(
'label' => esc_html__( 'Modal Background Overlay', 'divi-plus' ),
'type' => 'background-field',
'base_name' => 'modal_overlay_bg',
'context' => 'modal_overlay_bg_color',
'option_category' => 'button',
'custom_color' => true,
'background_fields' => $this->generate_background_options( 'modal_overlay_bg', 'button', 'general', 'background', 'modal_overlay_bg_color' ),
'hover' => false,
'mobile_options' => true,
'tab_slug' => 'general',
'toggle_slug' => 'background',
'description' => esc_html__( 'Customize the background of the modal background overlay by adjusting background color, gradient, and image.', 'divi-plus' ),
),
'modal_bg_color' => array(
'label' => esc_html__( 'Modal Background', 'divi-plus' ),
'type' => 'background-field',
'base_name' => 'modal_bg',
'context' => 'modal_bg_color',
'option_category' => 'button',
'custom_color' => true,
'background_fields' => $this->generate_background_options( 'modal_bg', 'button', 'general', 'background', 'modal_bg_color' ),
'hover' => false,
'mobile_options' => true,
'tab_slug' => 'general',
'toggle_slug' => 'background',
'description' => esc_html__( 'Customize the background of the modal by adjusting background color, gradient, and image.', 'divi-plus' ),
),
'modal_header_bg_color' => array(
'label' => esc_html__( 'Modal Header Background', 'divi-plus' ),
'type' => 'background-field',
'base_name' => 'modal_header_bg',
'context' => 'modal_header_bg_color',
'option_category' => 'button',
'custom_color' => true,
'background_fields' => $this->generate_background_options( 'modal_header_bg', 'button', 'general', 'background', 'modal_header_bg_color' ),
'hover' => false,
'mobile_options' => true,
'show_if' => array(
'show_header' => 'on',
),
'tab_slug' => 'general',
'toggle_slug' => 'background',
'description' => esc_html__( 'Customize the background of the modal header by adjusting background color, gradient, and image.', 'divi-plus' ),
),
'modal_body_bg_color' => array(
'label' => esc_html__( 'Modal Body Background', 'divi-plus' ),
'type' => 'background-field',
'base_name' => 'modal_body_bg',
'context' => 'modal_body_bg_color',
'option_category' => 'button',
'custom_color' => true,
'background_fields' => $this->generate_background_options( 'modal_body_bg', 'button', 'general', 'background', 'modal_body_bg_color' ),
'hover' => false,
'mobile_options' => true,
'tab_slug' => 'general',
'toggle_slug' => 'background',
'description' => esc_html__( 'Customize the background of the modal body by adjusting background color, gradient, and image.', 'divi-plus' ),
),
'modal_footer_bg_color' => array(
'label' => esc_html__( 'Modal Footer Background', 'divi-plus' ),
'type' => 'background-field',
'base_name' => 'modal_footer_bg',
'context' => 'modal_footer_bg_color',
'option_category' => 'button',
'custom_color' => true,
'background_fields' => $this->generate_background_options( 'modal_footer_bg', 'button', 'general', 'background', 'modal_footer_bg_color' ),
'hover' => false,
'mobile_options' => true,
'show_if' => array(
'show_footer' => 'on',
),
'tab_slug' => 'general',
'toggle_slug' => 'background',
'description' => esc_html__( 'Customize the background of the modal footer by adjusting background color, gradient, and image.', 'divi-plus' ),
),
'modal_close_icon' => array(
'type' => 'skip',
'default' => ET_BUILDER_PRODUCT_VERSION < '4.13.0' ? '%%48%%' : 'Q||divi||400',
'show_if' => array(
'show_header' => 'on',
'show_close_icon' => 'on',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_close_icon',
),
'modal_close_icon_font_size' => array(
'label' => esc_html__( 'Close Icon Font Size', 'divi-plus' ),
'type' => 'range',
'option_category' => 'font_option',
'range_settings' => array(
'min' => '1',
'max' => '120',
'step' => '1',
),
'default' => '32px',
'default_on_front' => '32px',
'mobile_options' => true,
'show_if' => array(
'show_header' => 'on',
'show_close_icon' => 'on',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_close_icon',
'description' => esc_html__( 'Move the slider or input the value to increase or decrease close icon size.', 'divi-plus' ),
),
'modal_close_icon_color' => array(
'label' => esc_html__( 'Close Icon Color', 'divi-plus' ),
'type' => 'color-alpha',
'default' => '#000',
'default_on_front' => '#000',
'show_if' => array(
'show_header' => 'on',
'show_close_icon' => 'on',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_close_icon',
'description' => esc_html__( 'Here you can define a custom color to be used for the close icon.', 'divi-plus' ),
),
'modal_position' => array(
'label' => esc_html__( 'Modal Position', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'top_left' => esc_html__( 'Top Left', 'divi-plus' ),
'top_right' => esc_html__( 'Top Right', 'divi-plus' ),
'top_center' => esc_html__( 'Top Center', 'divi-plus' ),
'bottom_left' => esc_html__( 'Bottom Left', 'divi-plus' ),
'bottom_right' => esc_html__( 'Bottom Right', 'divi-plus' ),
'bottom_center' => esc_html__( 'Bottom Center', 'divi-plus' ),
'center' => esc_html__( 'Center', 'divi-plus' ),
),
'default' => 'center',
'default_on_front' => 'center',
'tab_slug' => 'advanced',
'toggle_slug' => 'modal_sizing',
'description' => esc_html__( 'Here you can select where you want to place the modal on the page once triggered.', 'divi-plus' ),
),
'modal_animation_style' => array(
'label' => esc_html__( 'Modal Animation Style', 'divi-plus' ),
'type' => 'select_animation',
'option_category' => 'configuration',
'options' => array(
'none' => esc_html__( 'None', 'divi-plus' ),
'fade' => esc_html__( 'Fade', 'divi-plus' ),
'slide' => esc_html__( 'Slide', 'et_builder' ),
'bounce' => esc_html__( 'Bounce', 'et_builder' ),
'zoom' => esc_html__( 'Zoom', 'et_builder' ),
'flip' => esc_html__( 'Flip', 'et_builder' ),
'fold' => esc_html__( 'Fold', 'et_builder' ),
'roll' => esc_html__( 'Roll', 'et_builder' ),
),
'default' => 'fade',
'tab_slug' => 'advanced',
'toggle_slug' => 'animation',
'description' => esc_html__( 'Pick an animation style to enable animations for the modal. Once enabled, you will be able to customize your animation style further.', 'divi-plus' ),
),
'modal_animation_direction' => array(
'label' => esc_html__( 'Modal Animation Direction', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'center' => esc_html__( 'Center', 'et_builder' ),
'right' => esc_html__( 'Right', 'et_builder' ),
'left' => esc_html__( 'Left', 'et_builder' ),
'up' => esc_html__( 'Up', 'et_builder' ),
'down' => esc_html__( 'Down', 'et_builder' ),
),
'default' => 'center',
'show_if_not' => array(
'modal_animation_style' => array( 'none', 'fade' ),
),
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'animation',
'description' => esc_html__( 'Pick from up to five different animation directions, each of which will adjust the starting and ending position of your animated element.', 'divi-plus' ),
),
'modal_animation_duration' => array(
'label' => esc_html__( 'Modal Animation Duration', 'divi-plus' ),
'type' => 'range',
'option_category' => 'configuration',
'range_settings' => array(
'min' => 0,
'max' => 2000,
'step' => 50,
),
'default' => '1000ms',
'validate_unit' => true,
'fixed_unit' => 'ms',
'fixed_range' => true,
'show_if_not' => array(
'modal_animation_style' => 'none',
),
'reset_animation' => true,
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'animation',
'description' => esc_html__( 'Speed up or slow down your animation by adjusting the animation duration. Units are in milliseconds and the default animation duration is one second.', 'divi-plus' ),
),
'modal_animation_intensity' => array(
'label' => esc_html__( 'Modal Animation Intensity', 'divi-plus' ),
'type' => 'range',
'option_category' => 'configuration',
'range_settings' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
'default' => '50%',
'validate_unit' => true,
'fixed_unit' => '%',
'fixed_range' => true,
'show_if' => array(
'modal_animation_style' => array( 'slide', 'zoom', 'flip', 'fold', 'roll' ),
),
'reset_animation' => true,
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'animation',
'description' => esc_html__( 'Intensity effects how subtle or aggressive your animation will be. Lowering the intensity will create a smoother and more subtle animation while increasing the intensity will create a snappier more aggressive animation.', 'divi-plus' ),
),
'modal_animation_starting_opacity' => array(
'label' => esc_html__( 'Modal Animation Starting Opacity', 'divi-plus' ),
'type' => 'range',
'option_category' => 'configuration',
'range_settings' => array(
'min' => 0,
'max' => 100,
'step' => 1,
'min_limit' => 0,
'max_limit' => 100,
),
'default' => '0%',
'validate_unit' => true,
'fixed_unit' => '%',
'fixed_range' => true,
'reset_animation' => true,
'mobile_options' => true,
'show_if_not' => array(
'modal_animation_style' => 'none',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'animation',
'description' => esc_html__( 'By increasing the starting opacity, you can reduce or remove the fade effect that is applied to all animation styles.', 'divi-plus' ),
),
'modal_animation_speed_curve' => array(
'label' => esc_html__( 'Modal Animation Speed Curve', 'divi-plus' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'ease-in-out' => esc_html__( 'Ease-In-Out', 'divi-plus' ),
'ease' => esc_html__( 'Ease', 'divi-plus' ),
'ease-in' => esc_html__( 'Ease-In', 'divi-plus' ),
'ease-out' => esc_html__( 'Ease-Out', 'divi-plus' ),
'linear' => esc_html__( 'Linear', 'divi-plus' ),
),
'mobile_options' => true,
'default' => 'ease-in-out',
'show_if_not' => array(
'modal_animation_style' => 'none',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'animation',
'description' => esc_html__( 'Here you can adjust the easing method of your animation. Easing your animation in and out will create a smoother effect when compared to a linear speed curve.', 'divi-plus' ),
),
),
$this->generate_background_options( 'trigger_element_bg', 'skip', 'general', 'background', 'trigger_element_bg_color' ),
$this->generate_background_options( 'modal_overlay_bg', 'skip', 'general', 'background', 'modal_overlay_bg_color' ),
$this->generate_background_options( 'modal_bg', 'skip', 'general', 'background', 'modal_bg_color' ),
$this->generate_background_options( 'modal_header_bg', 'skip', 'general', 'background', 'modal_header_bg_color' ),
$this->generate_background_options( 'modal_body_bg', 'skip', 'general', 'background', 'modal_body_bg_color' ),
$this->generate_background_options( 'modal_footer_bg', 'skip', 'general', 'background', 'modal_footer_bg_color' )
);
}
public static function get_video( $args = array() ) {
$defaults = array(
'modal_content_video' => '',
);
$args = wp_parse_args( $args, $defaults );
if ( empty( $args['modal_content_video'] ) ) {
return '';
}
$video_src = '';
if ( false !== et_pb_check_oembed_provider( esc_url( $args['modal_content_video'] ) ) ) {
$video_src = wp_oembed_get( esc_url( $args['modal_content_video'] ) );
} else {
$video_src = sprintf(
'
',
( '' !== $args['modal_content_video'] ? sprintf( '