'et_pb_layout', 'numberposts' => -1));
self::$all_layouts[] = __('-- Select --', 'dd_builder');
foreach ($posts as $post) {
self::$all_layouts[$post->ID] = $post->post_title;
}
}
return self::$all_layouts;
}
public function get_alt_field( $show_if, $label ) {
$alt = array(
'label' => esc_html__( $label, 'et_builder' ),
'description' => esc_html__( 'This defines the HTML ALT text. A short description of your image can be placed here.', 'et_builder' ),
'type' => 'text',
'tab_slug' => 'custom_css',
'toggle_slug' => 'attributes'
);
if ($show_if !== '') $alt['show_if'] = $show_if;
return $alt;
}
public function get_custom_class_field() {
return array(
'label' => esc_html__( 'CSS Class', 'et_builder' ),
'description' => esc_html__( "Assign any number of CSS Classes to the element, separated by spaces, which can be used to assign custom CSS styles from within your child theme or from within Divi's custom CSS inputs.", 'et_builder' ),
'type' => 'text',
'tab_slug' => 'custom_css',
'toggle_slug' => 'classes',
'option_class' => 'et_pb_custom_css_regular',
);
}
public function get_custom_content_fields($settings) {
$prefix = isset($settings['prefix']) ? $settings['prefix'] . '_' : '';
$fields = array(
"{$prefix}cc_title" => array(
'label' => et_builder_i18n( 'Title' ),
'type' => 'text',
'dynamic_content' => 'text',
'mobile_options' => true,
'hover' => 'tabs',
'toggle_slug' => $settings['content_slug'],
),
"{$prefix}cc_url" => array(
'label' => esc_html__( 'Title Link URL', 'et_builder' ),
'type' => 'text',
'toggle_slug' => isset($settings['link_slug']) ? $settings['link_slug'] : $settings['advanced_slug'],
'dynamic_content' => 'url',
),
"{$prefix}cc_url_new_window" => array(
'label' => esc_html__( 'Title Link Target', 'et_builder' ),
'description' => esc_html__( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
'type' => 'select',
'options' => array(
'off' => esc_html__( 'In The Same Window', 'et_builder' ),
'on' => esc_html__( 'In The New Tab', 'et_builder' ),
),
'default' => 'off',
'toggle_slug' => isset($settings['link_slug']) ? $settings['link_slug'] : $settings['advanced_slug'],
),
"{$prefix}content" => array(
'label' => et_builder_i18n( 'Body' ),
'description' => esc_html__( 'Input the main text content for your module here.', 'et_builder' ),
'type' => 'tiny_mce',
'dynamic_content' => 'text',
'mobile_options' => true,
'hover' => 'tabs',
'toggle_slug' => $settings['content_slug'],
),
);
$icon_fields = isset($settings['icon']) && $settings['icon'] ? array(
"{$prefix}cc_icon_image" => array(
'label' => et_builder_i18n( 'Image/Icon' ),
'type' => 'multiple_buttons',
'options' => array(
'none' => array( 'title' => esc_html__('None', 'et_builder') ),
'icon' => array( 'title' => esc_html__('Icon', 'et_builder') ),
'image' => array( 'title' => esc_html__('Image', 'et_builder') ),
),
'default' => 'none',
'toggle_slug' => $settings['content_slug'],
),
"{$prefix}cc_icon" => array(
'label' => esc_html__( 'Icon', 'et_builder' ),
'type' => 'select_icon',
'class' => array( 'et-pb-font-icon' ),
'show_if' => array( "{$prefix}cc_icon_image" => 'icon' ),
'mobile_options' => true,
'hover' => 'tabs',
'toggle_slug' => $settings['content_slug'],
),
"{$prefix}cc_icon_color" => array(
'label' => esc_html__( 'Icon Color', 'et_builder' ),
'type' => 'color-alpha',
'default' => et_builder_accent_color(),
'hover' => 'tabs',
'mobile_options' => true,
'sticky' => true,
'show_if' => array( "{$prefix}cc_icon_image" => 'icon'),
'tab_slug' => 'advanced',
'toggle_slug' => isset($settings['icon_slug']) ? $settings['icon_slug'] : $settings['advanced_slug'],
),
"{$prefix}cc_image" => array(
'label' => esc_html__( 'Image', 'et_builder' ),
'type' => 'upload',
'upload_button_text'=> esc_attr__( 'Upload an image', 'et_builder' ),
'choose_text' => esc_attr__( 'Choose an Image', 'et_builder' ),
'update_text' => esc_attr__( 'Set As Image', 'et_builder' ),
'show_if' => array( "{$prefix}cc_icon_image" => 'image'),
'mobile_options' => true,
'hover' => 'tabs',
'dynamic_content' => 'image',
'toggle_slug' => $settings['content_slug'],
),
"{$prefix}cc_icon_width" => array(
'label' => esc_html__( 'Image/Icon Width', 'et_builder' ),
'type' => 'range',
'default' => '50px',
'default_unit' => 'px',
'show_if' => array( "{$prefix}cc_icon_image" => 'icon' ),
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => isset($settings['icon_slug']) ? $settings['icon_slug'] : $settings['advanced_slug'],
),
"{$prefix}cc_image_width" => array(
'label' => esc_html__( 'Image/Icon Width', 'et_builder' ),
'type' => 'range',
'default' => 'auto',
'default_unit' => '%',
'allowed_values' => et_builder_get_acceptable_css_string_values( 'width' ),
'show_if' => array( "{$prefix}cc_icon_image" => 'image' ),
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => isset($settings['icon_slug']) ? $settings['icon_slug'] : $settings['advanced_slug'],
),
"{$prefix}cc_alt" => array(
'label' => esc_html__( 'Custom Image Alt Text', 'dd_builder' ),
'description' => esc_html__( 'Define the HTML ALT text for your image here.', 'et_builder' ),
'type' => 'text',
'show_if' => array( "{$prefix}cc_icon_image" => 'image' ),
'tab_slug' => 'custom_css',
'toggle_slug' => 'attributes',
'dynamic_content' => 'text',
),
"{$prefix}cc_icon_placement" => array(
'label' => esc_html__( 'Image/Icon Placement', 'et_builder' ),
'description' => esc_html__( 'Here you can choose where to place the icon.', 'et_builder' ),
'type' => 'select',
'options' => array(
'column' => et_builder_i18n( 'Top' ),
'row' => et_builder_i18n( 'Left' ),
),
'default' => 'column',
'show_if' => array( "{$prefix}cc_icon_image" => array('icon', 'image')),
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => isset($settings['icon_slug']) ? $settings['icon_slug'] : $settings['advanced_slug'],
),
"{$prefix}cc_icon_alignment" => array(
'label' => esc_html__( 'Image/Icon Alignment', 'et_builder' ),
'description' => esc_html__( 'Align image/icon to the left, right or center.', 'et_builder' ),
'type' => 'align',
'options' => et_builder_get_text_orientation_options( array( 'justified' ) ),
'tab_slug' => 'advanced',
'toggle_slug' => isset($settings['icon_slug']) ? $settings['icon_slug'] : $settings['advanced_slug'],
'default' => 'center',
'mobile_options' => true,
'show_if' => array(
"{$prefix}cc_icon_image" => array('icon', 'image'),
"{$prefix}cc_icon_placement" => 'column',
),
),
"{$prefix}cc_icon_vertical_alignment" => array(
'label' => esc_html__( 'Image/Icon Alignment', 'et_builder' ),
'type' => 'select',
'options' => array('flex-start' => esc_html__( 'Top', 'et_builder' ), 'center' => esc_html__( 'Middle', 'et_builder' ), 'flex-end' => esc_html__( 'Bottom', 'et_builder' )),
'default' => 'flex-start',
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => isset($settings['icon_slug']) ? $settings['icon_slug'] : $settings['advanced_slug'],
'show_if' => array(
"{$prefix}cc_icon_image" => array('icon', 'image'),
"{$prefix}cc_icon_placement" => 'row',
),
),
"{$prefix}cc_gap" => array(
'label' => sprintf('%1$s %2$s', et_builder_i18n( 'Image/Icon' ), esc_html__( 'Offset', 'dd_builder' ) ),
'description' => esc_html__( 'Set the distance between the Image/Icon and the content Title/Body', 'dd_builder' ),
'type' => 'range',
'default' => '20px',
'default_unit' => 'px',
'show_if' => array( "{$prefix}cc_icon_image" => array('icon', 'image')),
'mobile_options' => true,
'sticky' => true,
'tab_slug' => 'advanced',
'toggle_slug' => isset($settings['icon_slug']) ? $settings['icon_slug'] : $settings['advanced_slug'],
),
) : array();
$button_fields = isset($settings['button']) && $settings['button'] ? array(
"{$prefix}cc_button_text" => array(
'label' => et_builder_i18n( 'Button' ),
'description' => esc_html__( 'Input your desired button text, or leave blank for no button.', 'et_builder' ),
'type' => 'text',
'mobile_options' => true,
'hover' => 'tabs',
'dynamic_content' => 'text',
'toggle_slug' => $settings['content_slug'],
),
"{$prefix}cc_button_url" => array(
'label' => esc_html__( 'Button Link URL', 'et_builder' ),
'type' => 'text',
'toggle_slug' => $settings['content_slug'],
'dynamic_content' => 'url',
),
"{$prefix}cc_button_new_window" => array(
'label' => esc_html__( 'Button Link Target', 'et_builder' ),
'description' => esc_html__( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
'type' => 'select',
'options' => array(
'off' => esc_html__( 'In The Same Window', 'et_builder' ),
'on' => esc_html__( 'In The New Tab', 'et_builder' ),
),
'default' => 'off',
'toggle_slug' => $settings['content_slug'],
),
) : array();
$fields = array_merge( $icon_fields, $fields, $button_fields );
foreach ($fields as $field => $field_settings) {
if (isset($settings['show_if_not']))
$fields[$field]['show_if_not'] = $settings['show_if_not'];
}
return $fields;
}
public function get_effect_options() {
return array(
'none' => esc_html__('-- None --', 'dd_builder'),
'fade' => esc_html__('Fade', 'et_builder'),
'slidedown' => esc_html__('Slide Down', 'et_builder'),
'slideup' => esc_html__('Slide Up', 'et_builder'),
'slideleft' => esc_html__('Slide Left', 'et_builder'),
'slideright' => esc_html__('Slide Right', 'et_builder'),
'zoom' => esc_html__('Zoom', 'et_builder'),
);
}
public function get_effect_fields($toggle_slug, $show_if, $default_in = 'none', $default_out = 'none', $default_ms = '1000ms', $only_in = false, $prefix = '') {
if ( $prefix !== '')
$prefix .= '_';
$fields = array(
"{$prefix}effect_in" => array(
'label' => esc_html__( 'Enter Effect', 'dd_builder' ),
'type' => 'select',
'options' => $this->get_effect_options(),
'default' => $default_in,
'tab_slug' => 'advanced',
'toggle_slug' => $toggle_slug,
),
);
$fields["{$prefix}effect_in_intensity"] = array(
'label' => sprintf( '%1$s %2$s', esc_html__( 'Enter Effect', 'dd_builder' ), esc_html__( 'Animation Intensity', 'et_builder' )),
'type' => 'range',
'default' => '100%',
'fixed_unit' => '%',
'show_if_not' => array( "{$prefix}effect_in" => 'none' ),
'tab_slug' => 'advanced',
'toggle_slug' => $toggle_slug,
);
if (!$only_in) {
$fields["{$prefix}effect_out"] = array(
'label' => esc_html__( 'Exit Effect', 'dd_builder' ),
'type' => 'select',
'options' => $this->get_effect_options(),
'default' => $default_out,
'tab_slug' => 'advanced',
'toggle_slug' => $toggle_slug,
);
$fields["{$prefix}effect_out_intensity"] = array(
'label' => sprintf( '%1$s %2$s', esc_html__( 'Exit Effect', 'dd_builder' ), esc_html__( 'Animation Intensity', 'et_builder' )),
'type' => 'range',
'default' => '100%',
'fixed_unit' => '%',
'show_if_not' => array( "{$prefix}effect_out" => 'none' ),
'tab_slug' => 'advanced',
'toggle_slug' => $toggle_slug,
);
}
$fields["{$prefix}effect_opacity"] = array(
'label' => esc_html__( 'Opacity', 'et_builder' ),
'type' => 'yes_no_button',
'options' => $this->get_yes_no_button_options(),
'default' => 'off',
'show_if_not' => array("{$prefix}effect_in" => array('none', 'fade' )),
'tab_slug' => 'advanced',
'toggle_slug' => $toggle_slug,
);
$fields["{$prefix}effect_opacity_intensity"] = array(
'label' => sprintf( '%1$s %2$s', esc_html__( 'Opacity', 'et_builder' ), esc_html__( 'Intensity', 'dd_builder' ) ),
'type' => 'range',
'default' => '100%',
'fixed_unit' => '%',
'show_if_not' => array( "{$prefix}effect_opacity" => 'off' ),
'tab_slug' => 'advanced',
'toggle_slug' => $toggle_slug,
);
$fields["{$prefix}effect_ms"] = array(
'label' => esc_html__( 'Duration', 'dd_builder' ),
'type' => 'range',
'default' => $default_ms,
'default_unit' => 'ms',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle_slug,
);
if ($show_if) {
$fields["{$prefix}effect_in"]['show_if'] = $show_if;
$fields["{$prefix}effect_out"]['show_if'] = $show_if;
$fields["{$prefix}effect_in_intensity"]['show_if'] = $show_if;
$fields["{$prefix}effect_out_intensity"]['show_if'] = $show_if;
$fields["{$prefix}effect_opacity"]['show_if'] = $show_if;
$fields["{$prefix}effect_ms"]['show_if'] = $show_if;
}
return $fields;
}
public function get_font_fields( $ul, $ol, $quote, $toggle ) {
return array(
"{$ul}_type" => array(
'label' => esc_html__( 'Unordered List Style Type', 'et_builder' ),
'description' => esc_html__( 'This setting adjusts the shape of the bullet point that begins each list item.', 'et_builder' ),
'type' => 'select',
'options' => array(
'disc' => et_builder_i18n( 'Disc' ),
'circle' => et_builder_i18n( 'Circle' ),
'square' => et_builder_i18n( 'Square' ),
'none' => et_builder_i18n( 'None' ),
),
'priority' => 80,
'default' => 'disc',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'ul',
'mobile_options' => true,
),
"{$ul}_position" => array(
'label' => esc_html__( 'Unordered List Style Position', 'et_builder' ),
'description' => esc_html__( 'The bullet point that begins each list item can be placed either inside or outside the parent list wrapper. Placing list items inside will indent them further within the list.', 'et_builder' ),
'type' => 'select',
'options' => array(
'outside' => et_builder_i18n( 'Outside' ),
'inside' => et_builder_i18n( 'Inside' ),
),
'priority' => 85,
'default' => 'outside',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'ul',
'mobile_options' => true,
),
"{$ul}_item_indent" => array(
'label' => esc_html__( 'Unordered List Item Indent', 'et_builder' ),
'description' => esc_html__( 'Increasing indentation will push list items further towards the center of the text content, giving the list more visible separation from the the rest of the text.', 'et_builder' ),
'type' => 'range',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'ul',
'priority' => 90,
'default' => '0px',
'default_unit' => 'px',
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
'min' => '0',
'max' => '100',
'step' => '1',
),
'mobile_options' => true,
),
"{$ol}_type" => array(
'label' => esc_html__( 'Ordered List Style Type', 'et_builder' ),
'description' => esc_html__( 'Here you can choose which types of characters are used to distinguish between each item in the ordered list.', 'et_builder' ),
'type' => 'select',
'options' => array(
'decimal' => 'decimal',
'armenian' => 'armenian',
'cjk-ideographic' => 'cjk-ideographic',
'decimal-leading-zero' => 'decimal-leading-zero',
'georgian' => 'georgian',
'hebrew' => 'hebrew',
'hiragana' => 'hiragana',
'hiragana-iroha' => 'hiragana-iroha',
'katakana' => 'katakana',
'katakana-iroha' => 'katakana-iroha',
'lower-alpha' => 'lower-alpha',
'lower-greek' => 'lower-greek',
'lower-latin' => 'lower-latin',
'lower-roman' => 'lower-roman',
'upper-alpha' => 'upper-alpha',
'upper-greek' => 'upper-greek',
'upper-latin' => 'upper-latin',
'upper-roman' => 'upper-roman',
'none' => 'none',
),
'priority' => 80,
'default' => 'decimal',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'ol',
'mobile_options' => true,
),
"{$ol}_position" => array(
'label' => esc_html__( 'Ordered List Style Position', 'et_builder' ),
'description' => esc_html__( 'The characters that begins each list item can be placed either inside or outside the parent list wrapper. Placing list items inside will indent them further within the list.', 'et_builder' ),
'type' => 'select',
'options' => array(
'inside' => et_builder_i18n( 'Inside' ),
'outside' => et_builder_i18n( 'Outside' ),
),
'priority' => 85,
'default' => 'inside',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'ol',
'mobile_options' => true,
),
"{$ol}_item_indent" => array(
'label' => esc_html__( 'Ordered List Item Indent', 'et_builder' ),
'description' => esc_html__( 'Increasing indentation will push list items further towards the center of the text content, giving the list more visible separation from the the rest of the text.', 'et_builder' ),
'type' => 'range',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'ol',
'priority' => 90,
'default' => '0px',
'default_unit' => 'px',
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
'min' => '0',
'max' => '100',
'step' => '1',
),
'mobile_options' => true,
),
"{$quote}_border_weight" => array(
'label' => esc_html__( 'Blockquote Border Weight', 'et_builder' ),
'description' => esc_html__( 'Block quotes are given a border to separate them from normal text. You can increase or decrease the size of that border using this setting.', 'et_builder' ),
'type' => 'range',
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'quote',
'priority' => 85,
'default' => '5px',
'default_unit' => 'px',
'default_on_front' => '',
'allowed_units' => array( 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
'min' => '0',
'max' => '100',
'step' => '1',
),
'mobile_options' => true,
'sticky' => true,
'hover' => 'tabs',
),
"{$quote}_border_color" => array(
'label' => esc_html__( 'Blockquote Border Color', 'et_builder' ),
'description' => esc_html__( 'Block quotes are given a border to separate them from normal text. Pick a color to use for that border.', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
'toggle_slug' => $toggle,
'sub_toggle' => 'quote',
'field_template' => 'color',
'priority' => 90,
'mobile_options' => true,
'sticky' => true,
'hover' => 'tabs',
),
);
}
public function get_layouts() {
if (empty(self::$layouts)) {
$posts = get_posts(array('post_type' => 'et_pb_layout', 'numberposts' => -1));
self::$layouts[] = __('-- Select --', 'dd_builder');
foreach ($posts as $post) {
if ( strpos($post->post_content, 'ddbuilder_menu') !== false )
continue;
self::$layouts[$post->ID] = $post->post_title;
}
}
return self::$layouts;
}
public function get_popup_fields($settings) {
$preview = array();
if ( isset( $settings['preview'])) {
$preview['popup_preview'] = array(
'label' => esc_html__( 'Preview in the Builder', 'dd_builder' ),
'description' => esc_html__( 'Toggle this field to temporarily preview the popup.', 'dd_builder' ),
'type' => 'yes_no_button',
'options' => $this->get_yes_no_button_options(),
'default' => 'off',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'toggle_slug' => $settings['toggle_slug'],
);
}
$content_fields = array (
'popup_hover' => array(
'label' => esc_html__( 'Show On Hover', 'dd_builder' ),
'description' => esc_html__( 'Here you can choose whether te popup should be displayed on hover as well.', 'dd_builder' ),
'type' => 'yes_no_button',
'options' => $this->get_yes_no_button_options(),
'default' => 'off',
'show_if' => isset($settings['show_if_hover']) ? $settings['show_if_hover'] : (
isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if']
),
'toggle_slug' => $settings['toggle_slug'],
),
'popup_close' => array(
'label' => esc_html__( 'Show Close Icon', 'dd_builder' ),
'description' => esc_html__( 'Here can you choose whether or not a close icon should be also used to dismiss the popup.', 'dd_builder' ),
'type' => 'yes_no_button',
'options' => $this->get_yes_no_button_options(),
'default' => 'off',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'toggle_slug' => $settings['toggle_slug'],
),
'popup_close_font_icon' => array(
'label' => esc_html__( 'Close Icon', 'dd_builder' ),
'type' => 'select_icon',
'class' => array( 'et-pb-font-icon' ),
'default' => 'M||divi||400',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'show_if_not' => array('popup_close' => 'off'),
'toggle_slug' => $settings['toggle_slug'],
'hover' => 'tabs',
),
'popup_close_click' => array(
'label' => esc_html__( 'Close On Icon Click Only', 'dd_builder' ),
'type' => 'yes_no_button',
'options' => $this->get_yes_no_button_options(),
'default' => 'off',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'show_if_not' => array('popup_close' => 'off'),
'mobile_options' => true,
'toggle_slug' => $settings['toggle_slug'],
),
'popup_disable_page_scroll' => array(
'label' => esc_html__( 'Disable Page Scroll', 'dd_builder' ),
'description' => esc_html__( 'Here can you choose whether or not the page scroll should be disabled when the popup is open.', 'dd_builder' ),
'type' => 'yes_no_button',
'options' => $this->get_yes_no_button_options(),
'default' => 'off',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'toggle_slug' => $settings['toggle_slug'],
),
'__popup' => array(
'type' => 'computed',
'computed_callback' => array( 'DonDiviBuilderHelper', 'render_divi_layout' ),
'computed_depends_on' => array(
'divi_layout',
),
'computed_minimum' => array(
'divi_layout',
),
),
);
$design_fields = array(
'popup_location' => array(
'label' => esc_html__( 'Location', 'et_builder' ),
'type' => 'select',
'options' => ddbuilder_get_location_options(),
'default' => 'center',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => $settings['advanced_slug'],
),
'popup_max_width' => array(
'label' => esc_html__( 'Popup Max Width', 'dd_builder' ),
'type' => 'range',
'range_settings' => array(
'min_limit' => 10,
'step' => 1,
),
'fixed_unit' => '%',
'default' => '80%',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'mobile_options' => true,
'tab_slug' => 'advanced',
'toggle_slug' => $settings['advanced_slug'],
),
'popup_max_height' => array(
'label' => esc_html__( 'Popup Max Height', 'dd_builder' ),
'type' => 'range',
'range_settings' => array(
'min_limit' => 10,
'step' => 1,
),
'fixed_unit' => '%',
'default' => '80%',
'mobile_options' => true,
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'tab_slug' => 'advanced',
'toggle_slug' => $settings['advanced_slug'],
),
'content_background_color' => array(
'label' => esc_html__( 'Background Color', 'et_builder' ),
'type' => 'color-alpha',
'default' => '#ffffff',
'mobile_options' => true,
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'tab_slug' => 'advanced',
'toggle_slug' => $settings['advanced_slug'],
),
'overlay_color' => array(
'label' => esc_html__( 'Overlay Color', 'dd_builder' ),
'type' => 'color-alpha',
'default' => 'rgba(0,0,0,0.4)',
'mobile_options' => true,
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'tab_slug' => 'advanced',
'toggle_slug' => $settings['advanced_slug'],
),
'popup_close_text_color' => array(
'label' => esc_html__( 'Close Icon Color', 'dd_builder' ),
'type' => 'color-alpha',
'default' => '#666666',
'mobile_options' => true,
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'show_if_not' => array( 'popup_close' => 'off'),
'tab_slug' => 'advanced',
'toggle_slug' => $settings['advanced_slug'],
),
'popup_close_font_size' => array(
'label' => esc_html__( 'Close Icon Font Size', 'dd_builder' ),
'type' => 'range',
'default' => '40px',
'fixed_unit' => 'px',
'mobile_options' => true,
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'show_if_not' => array( 'popup_close' => 'off'),
'tab_slug' => 'advanced',
'toggle_slug' => $settings['advanced_slug'],
),
);
$advanced_fields = array(
'popup_id' => array(
'label' => esc_html__( 'Popup ID', 'dd_builder' ),
'type' => 'text',
'show_if' => isset($settings['show_if_custom']) ? $settings['show_if_custom'] : $settings['show_if'],
'tab_slug' => 'custom_css',
'toggle_slug' => 'classes',
'option_class' => 'et_pb_custom_css_regular',
),
);
return array_merge( $preview, $content_fields, $design_fields, $advanced_fields );
}
public function get_positions() {
$positions = array(
'top' => esc_html__( 'Top', 'et_builder' ),
'right' => esc_html__( 'Right', 'et_builder' ),
'bottom' => esc_html__( 'Bottom', 'et_builder' ),
'left' => esc_html__( 'Left', 'et_builder' ),
);
return $positions;
}
public function get_url_fields($toggle_slug, $link_types, $rel_values) {
return array(
'url' => array(
'label' => esc_html__( 'URL', 'et_builder' ),
'description' => esc_html__( 'Enter your destination URL here.', 'dd_builder' ),
'type' => 'text',
'show_if' => array('link_type' => $link_types),
'toggle_slug' => $toggle_slug,
'dynamic_content' => 'url',
),
'url_new_window' => array(
'label' => esc_html__( 'URL Opens', 'dd_builder' ),
'description' => esc_html__( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
'type' => 'select',
'options' => array(
'off' => esc_html__( 'In The Same Window', 'et_builder' ),
'on' => esc_html__( 'In The New Tab', 'et_builder' ),
),
'show_if' => array('link_type' => $link_types),
'default' => 'off',
'toggle_slug' => $toggle_slug,
),
'link_rel' => array(
'label' => esc_html__( 'Link Relationship', 'et_builder' ),
'type' => 'multiple_checkboxes',
'options' => $rel_values,
'show_if' => array('link_type' => $link_types),
'description' => et_get_safe_localization( __( "Specify the value of your link's rel attribute. The rel attribute specifies the relationship between the current document and the linked document.
Tip: Search engines can use this attribute to get more information about a link.", 'et_builder' ) ),
'tab_slug' => 'custom_css',
'toggle_slug' => 'attributes',
),
);
}
public function get_yes_no_button_options() {
return array(
'off' => et_builder_i18n( 'No' ),
'on' => et_builder_i18n( 'Yes' ),
);
}
}
class DonDiviBuilderHelper {
private static $instance;
public static function get() {
if ( empty( self::$instance ) ) {
self::$instance = new DonDiviBuilderHelper();
}
return self::$instance;
}
public static function render_divi_layout( $args = array() ) {
global $et_pb_rendering_column_content;
$defaults = array(
'internal' => true,
);
$args = wp_parse_args( $args, $defaults );
$layout_id = '';
if ( !empty( $args['layout_id'] ) )
$layout_id = $args['layout_id'];
else if ( !empty( $args['divi_layout'] ) )
$layout_id = $args['divi_layout'];
else return $layout_id;
if ( $args['internal'] ) $et_pb_rendering_column_content = true;
//ET_Builder_Element::clean_internal_modules_styles();
$rendered_layout = do_shortcode( get_the_content( null, false, $layout_id ) );
if ($args['internal']) {
$rendered_layout .= '';
$et_pb_rendering_column_content = false;
}
//ET_Builder_Element::clean_internal_modules_styles( false );
return $rendered_layout;
}
public static function render_wp_nav_menu( $args = array(), $conditional_tags = array(), $current_page = array() ) {
$defaults = array(
'frontend' => false,
'wp_accordion' => 'off',
'wp_collapse' => 'off',
'wp_menu_id' => '',
);
$args = wp_parse_args( $args, $defaults );
$menu_args = array(
'container' => '',
'link_before' => '',
'link_after' => '',
'link_class' => 'ddb-wp-item ddb-f ddb-dark ddb-p-xs',
'menu' => (int) $args['wp_menu_id'],
'menu_class' => '',
'echo' => false,
);
if ($args['wp_collapse'] === 'on') {
$menu_args['li_collapse_class'] = $args['wp_accordion'] === 'on' ? 'ddb-collapsible ddb-accordion' : 'ddb-collapsible';
$menu_args['link_collapse_class'] = $menu_args['link_class'] . ' ddb-collapse';
if ($args['frontend']) {
$helper = DonDiviBuilderHelper::get();
$menu_args['link_after'] = '' . $helper->render_icon( array(
'module' => $args['module_instance'],
'icon_attr' => 'wp_menu_icon',
'selector' => '%%order_class%% span.ddb-collapse',
'hover_selector' => '%%order_class%% .ddb-collapse.active > span.ddb-collapse',
'attrs' => array( 'class' => 'ddb-collapse ddb-click notranslate'),
'custom' => true
) );
} else
$menu_args['link_after'] = sprintf('', esc_html( et_pb_extended_process_font_icon( $args['wp_menu_icon'] )));
}
return wp_nav_menu( apply_filters( 'dondivi_wp_nav_menu_args', $menu_args ) );
}
public function get_flex_alignment($property, $direction, $main_axis, $cross_axis) {
if ( ($property === 'justify' && $direction !== 'column' && $direction !== 'column-reverse') || ($property === 'align' && ( $direction === 'column' || $direction === 'column-reverse'))) {
switch ($main_axis) {
case 'flex-start':
case 'top':
case 'left':
case 'force_left': return $direction === 'column-reverse' || $direction === 'row-reverse' ? 'flex-end' : 'flex-start';
case 'justified': return $direction === 'column' || $direction === 'column-reverse' ? 'center' : 'space-between';
case 'flex-end':
case 'bottom':
case 'right': return $direction === 'column-reverse' || $direction === 'row-reverse' ? 'flex-start' : 'flex-end';
default:
return 'center';
}
}
if ( ($property === 'align' && $direction !=='column') || ($property === 'justify' && $direction === 'column') )
return $cross_axis;
return 'center';
}
public function get_responsive_classnames($field_values, $responsive, $base_class, $values) {
$classes = array();
if ( !$responsive) {
if (in_array($field_values['desktop'], $values)) $classes []= $base_class;
} else {
if (in_array($field_values['desktop'], $values)) $classes []= "$base_class-d";
if (in_array($field_values['tablet'], $values)) $classes []= "$base_class-t";
if (in_array($field_values['phone'], $values)) $classes []= "$base_class-p";
}
return implode(' ', $classes);
}
public function get_custom_button($module, $button_name, $button_text, $button_esc_text, $button_classes, $wrapper_classes = '', $has_url_field = false, $prefix = '') {
$multi_view = et_pb_multi_view_options( $module );
$button_url = !$has_url_field ? '#' : $module->props["{$prefix}cc_button_url"];
$button_rel = isset($module->props[$button_name . '_rel']) ? $module->props[$button_name . '_rel'] : '';
$icon_values = et_pb_responsive_options()->get_property_values( $module->props, "{$button_name}_icon" );
$icon = isset( $icon_values['desktop'] ) ? $icon_values['desktop'] : '';
$icon_tablet = isset( $icon_values['tablet'] ) ? $icon_values['tablet'] : '';
$icon_phone = isset( $icon_values['phone'] ) ? $icon_values['phone'] : '';
$visibility = array(
"$button_text" => '__not_empty',
);
if ( $has_url_field ) $visibility["{$prefix}cc_button_url"] = '__not_empty';
$button = $module->render_button(
array(
'button_classname' => array( $button_classes ),
'button_custom' => $module->props['custom_' . $button_name],
'button_rel' => $button_rel,
'button_text' => !empty($button_esc_text) ? $button_esc_text : $module->props[$button_text],
'button_text_escaped' => !empty($button_esc_text),
'button_url' => $button_url,
'custom_icon' => $icon,
'custom_icon_tablet' => $icon_tablet,
'custom_icon_phone' => $icon_phone,
'has_wrapper' => false,
'url_new_window' => $has_url_field ? $module->props["{$prefix}cc_button_new_window"] : '',
'display_button' => ( (!$has_url_field || '' !== $button_url) && $multi_view->has_value( $button_text ) ),
'multi_view_data' => $multi_view->render_attrs(
array(
'content' => '{{' . $button_text .'}}',
'visibility' => $visibility,
)
),
)
);
if ($button) $button = sprintf('