* @link https://www.elicus.com/ * @copyright 2022 Elicus Technologies Private Limited * @version 1.9.6 */ class DIPL_ImageCardCarouselItem extends ET_Builder_Module { public $slug = 'dipl_image_card_carousel_item'; public $type = 'child'; 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 Image Card Carousel', 'divi-plus' ); $this->advanced_setting_title_text = esc_html__( 'DP Image Card', 'divi-plus' ); $this->child_title_var = 'title'; $this->main_css_element = '.dipl_image_card_carousel %%order_class%%'; if ( is_archive() ) { $this->main_css_element = '%%order_class%%'; } add_filter( 'et_builder_processed_range_value', array( $this, 'dipl_builder_processed_range_value' ), 10, 3 ); } public function get_settings_modal_toggles() { return array( 'general' => array( 'toggles' => array( 'main_content' => array( 'title' => esc_html__( 'Content', 'divi-plus' ), ), 'image' => array( 'title' => esc_html__( 'Image', 'divi-plus' ), ), 'icon' => array( 'title' => esc_html__( 'Icon', 'divi-plus' ), ), 'button' => array( 'title' => esc_html__( 'Button', 'divi-plus' ), ), ), ), 'advanced' => array( 'toggles' => array( 'text' => array( 'title' => esc_html__( 'Text', 'divi-plus' ), ), 'text_settings' => array( 'title' => esc_html__( 'Title & Content', 'divi-plus' ), 'sub_toggles' => array( 'title' => array( 'name' => 'Title', ), 'content' => array( 'name' => 'Content', ), ), 'tabbed_subtoggles' => true, ), 'icon' => array( 'title' => esc_html__( 'Icon', 'divi-plus' ), ), 'button' => array( 'title' => esc_html__( 'Button', 'divi-plus' ), ), ), ), ); } public function get_advanced_fields_config() { return array( 'fonts' => array( 'title' => array( 'label' => esc_html__( 'Title', 'divi-plus' ), 'font_size' => array( 'default' => '16px', 'range_settings' => array( 'min' => '1', 'max' => '100', 'step' => '1', ), 'validate_unit' => true, ), 'line_height' => array( 'default_on_front' => '1.2em', 'range_settings' => array( 'min' => '0.1', 'max' => '10', 'step' => '0.1', ), ), 'letter_spacing' => array( 'default_on_front' => '0px', 'range_settings' => array( 'min' => '0', 'max' => '10', 'step' => '1', ), 'validate_unit' => true, ), 'header_level' => array( 'default' => 'h4', ), 'css' => array( 'main' => "{$this->main_css_element} .dipl_image_card_title", 'important' => 'all', ), 'tab_slug' => 'advanced', 'toggle_slug' => 'text_settings', 'sub_toggle' => 'title', ), 'content' => array( 'label' => esc_html__( 'Content', '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, ), 'css' => array( 'main' => "{$this->main_css_element} .dipl_image_card_content", 'important' => 'all', ), 'tab_slug' => 'advanced', 'toggle_slug' => 'text_settings', 'sub_toggle' => 'content', ), ), 'margin_padding' => array( 'css' => array( 'main' => '%%order_class%%', 'important' => 'all', ), ), 'image_card_margin_padding' => array( 'content' => array( 'margin_padding' => array( 'css' => array( 'use_margin' => false, 'padding' => '%%order_class%% .dipl_image_card_content_wrapper', 'important' => 'all', ), ), ), ), 'button' => array( 'button' => array( 'label' => esc_html__( 'Button', 'divi-plus' ), 'css' => array( 'main' => "{$this->main_css_element} .et_pb_button", 'alignment' => "{$this->main_css_element} .et_pb_button_wrapper", 'important' => 'all', ), 'margin_padding' => array( 'css' => array( 'margin' => "{$this->main_css_element} .et_pb_button_wrapper", 'padding' => "{$this->main_css_element} .et_pb_button", 'important' => 'all', ), ), 'border_width' => array( 'default' => '2px', ), 'use_alignment' => true, 'box_shadow' => false, 'depends_on' => array( 'show_button' ), 'depends_show_if' => 'on', 'tab_slug' => 'advanced', 'toggle_slug' => 'button', ), ), 'max_width' => array( 'css' => array( 'main' => '%%order_class%%', 'module_alignment' => '%%order_class%%', ), ), 'borders' => array( 'default' => array( 'css' => array( 'main' => array( 'border_styles' => '%%order_class%%', 'border_radii' => '%%order_class%%', ), 'important' => 'all', ), ), ), 'box_shadow' => array( 'default' => array( 'css' => array( 'main' => '%%order_class%%', ), ), ), 'text' => array( 'use_background_layout' => true, 'options' => array( 'background_layout' => array( 'default' => 'light', 'default_on_front' => 'light', 'hover' => 'tabs', ), ), ), 'filters' => false, 'text_shadow' => false, ); } public function get_fields() { return array_merge( array( 'title' => array( 'label' => esc_html__( 'Title', 'divi-plus' ), 'type' => 'text', 'option_category' => 'basic_option', 'default_on_front' => esc_html__( 'Title', 'divi-plus' ), 'default' => esc_html__( 'Title', 'divi-plus' ), 'tab_slug' => 'general', 'toggle_slug' => 'main_content', 'description' => esc_html__( 'Here you can input the text to be used for the title.', 'divi-plus' ), ), 'content' => array( 'label' => esc_html__( 'Content', 'divi-plus' ), 'type' => 'tiny_mce', 'option_category' => 'basic_option', 'toggle_slug' => 'main_content', 'description' => esc_html__( 'Here you can input the text to be used for the content.', 'divi-plus' ), ), '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' ), 'dynamic_content' => 'image', 'tab_slug' => 'general', 'toggle_slug' => 'image', 'description' => esc_html__( 'Upload an image to display at the top of your blurb.', 'divi-plus' ), ), 'image_alt' => array( 'label' => esc_html__( 'Image Alt Text', 'divi-plus' ), 'type' => 'text', 'option_category' => 'basic_option', 'tab_slug' => 'general', 'toggle_slug' => 'image', 'description' => esc_html__( 'Here you can input the text to be used for the image as HTML ALT text.', 'divi-plus' ), ), 'icon' => array( 'label' => esc_html__( 'Icon', 'divi-plus' ), 'type' => 'select_icon', 'option_category' => 'basic_option', 'class' => array( 'et-pb-font-icon' ), 'tab_slug' => 'general', 'toggle_slug' => 'icon', 'description' => esc_html__( 'Choose an icon to display.', 'divi-plus' ), ), 'icon_alignment' => array( 'label' => esc_html__( 'Icon Alignment', 'divi-plus' ), 'type' => 'text_align', 'option_category' => 'layout', 'options' => et_builder_get_text_orientation_options( array( 'justified' ) ), 'mobile_options' => true, 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'description' => esc_html__( 'Here you can choose where to place an icon on the image card.', 'divi-plus' ), ), 'icon_font_size' => array( 'label' => esc_html__( 'Icon Font Size', 'divi-plus' ), 'type' => 'range', 'option_category' => 'font_option', 'range_settings' => array( 'min' => '1', 'max' => '120', 'step' => '1', ), 'mobile_options' => true, 'default' => '', 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'description' => esc_html__( 'Control the size of the icon by increasing or decreasing the font size.', 'divi-plus' ), ), 'icon_color' => array( 'label' => esc_html__( 'Icon Color', 'divi-plus' ), 'type' => 'color-alpha', 'hover' => 'tabs', 'mobile_options' => true, 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'description' => esc_html__( 'Here you can define a custom color for your icon.', 'divi-plus' ), ), 'style_icon' => array( 'label' => esc_html__( 'Style 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' => 'off', 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'description' => esc_html__( 'Here you can choose whether icon should display within a shape or not.', 'divi-plus' ), ), 'icon_shape' => array( 'label' => esc_html__( 'Shape', 'divi-plus' ), 'type' => 'select', 'option_category' => 'configuration', 'options' => array( 'dipl_icon_shape_square' => esc_html__( 'Square', 'divi-plus' ), 'dipl_icon_shape_circle' => esc_html__( 'Circle', 'divi-plus' ), 'dipl_icon_shape_hexagon' => esc_html__( 'Hexagon', 'divi-plus' ), ), 'show_if' => array( 'style_icon' => 'on', ), 'default' => 'dipl_icon_shape_square', 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'description' => esc_html__( 'Here you can choose shape to display icon within.', 'divi-plus' ), ), 'shape_bg_color' => array( 'label' => esc_html__( 'Shape Background', 'divi-plus' ), 'type' => 'color-alpha', 'custom_color' => true, 'show_if' => array( 'style_icon' => 'on', ), 'default' => '#000', 'default_on_front' => '#000', 'hover' => 'tabs', 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'description' => esc_html__( 'Pick a color to be used for the icon shape.', 'divi-plus' ), ), 'show_button' => array( 'label' => esc_html__( 'Show Button', 'divi-plus' ), 'type' => 'yes_no_button', 'option_category' => 'basic_option', 'options' => array( 'off' => esc_html__( 'No', 'divi-plus' ), 'on' => esc_html__( 'Yes', 'divi-plus' ), ), 'affects' => array( 'custom_button', ), 'default' => 'off', 'tab_slug' => 'general', 'toggle_slug' => 'button', 'description' => esc_html__( 'Here you can choose whether or not display button.', 'divi-plus' ), ), 'button_text' => array( 'label' => esc_html__( 'Button Text', 'divi-plus' ), 'type' => 'text', 'option_category' => 'basic_option', 'show_if' => array( 'show_button' => 'on', ), 'default' => esc_html__( 'Read More', 'divi-plus' ), 'default_on_front' => esc_html__( 'Read More', 'divi-plus' ), 'tab_slug' => 'general', 'toggle_slug' => 'button', 'description' => esc_html__( 'Here you can input the text to be used for the Button.', 'divi-plus' ), ), 'button_url' => array( 'label' => esc_html__( 'Url', 'divi-plus' ), 'type' => 'text', 'option_category' => 'basic_option', 'default' => '#', 'default_on_front' => '#', 'show_if' => array( 'show_button' => 'on', ), 'dynamic_content' => 'url', 'tab_slug' => 'general', 'toggle_slug' => 'button', 'description' => esc_html__( 'Here you can input the URL that you want to open when the user clicks on the button.', 'divi-plus' ), ), 'button_url_new_window' => array( 'label' => esc_html__( 'Link Target', 'divi-plus' ), 'type' => 'select', 'option_category' => 'configuration', 'options' => array( 'off' => esc_html__( 'In The Same Window', 'divi-plus' ), 'on' => esc_html__( 'In The New Tab', 'divi-plus' ), ), 'default' => 'off', 'default_on_front' => 'off', 'show_if' => array( 'show_button' => 'on', ), 'tab_slug' => 'general', 'toggle_slug' => 'button', 'description' => esc_html__( 'Here you can choose whether or not the link opens in a new window.', 'divi-plus' ), ), 'content_custom_padding' => array( 'label' => esc_html__( 'Content Padding', 'divi-plus' ), 'type' => 'custom_padding', 'option_category' => 'layout', 'mobile_options' => true, 'hover' => false, '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' ), ), 'content_bg_color' => array( 'label' => esc_html__( 'Content Background', 'divi-plus' ), 'type' => 'background-field', 'base_name' => 'content_bg', 'context' => 'content_bg_color', 'option_category' => 'button', 'custom_color' => true, 'background_fields' => $this->generate_background_options( 'content_bg', 'button', 'advanced', 'background', 'content_bg_color' ), 'hover' => 'tabs', 'tab_slug' => 'general', 'toggle_slug' => 'background', 'description' => esc_html__( 'Customize the background style of the content box by adjusting the background color, gradient, and image.', 'divi-plus' ), ), ), $this->generate_background_options( 'content_bg', 'skip', 'general', 'background', 'content_bg_color' ) ); } public function render( $attrs, $content, $render_slug ) { global $dp_icc_parent_icon_font_size, $dp_icc_parent_attrs; $multi_view = et_pb_multi_view_options( $this ); $style_icon = $this->props['style_icon']; $button_text = sprintf( esc_html__( '%s', 'divi-plus' ), $this->props['button_text'] ); $button_url_new_window = $this->props['button_url_new_window']; $image_alt = sprintf( esc_html__( '%s', 'divi-plus' ), $this->props['image_alt'] ); $title_level = $this->props['title_level']; $processed_title_level = et_pb_process_header_level( $title_level, 'h4' ); $processed_title_level = esc_html( $processed_title_level ); $icon_shape = 'on' === $style_icon ? esc_attr( $this->props['icon_shape'] ) : ''; $icon_classes = implode( ' ', array( 'dipl_image_card_icon', 'et-pb-icon', $icon_shape, ) ); $icon = $multi_view->render_element( array( 'content' => '{{icon}}', 'attrs' => array( 'class' => $icon_classes, ), 'required' => 'icon', ) ); if ( 'dipl_icon_shape_hexagon' === $icon_shape ) { $icon = sprintf( '