class ET_Builder_Module_Social_Media_Follow extends ET_Builder_Module {
$this->name = esc_html__( 'Social Media Follow', 'et_builder' );
$this->plural = esc_html__( 'Social Media Follows', 'et_builder' );
$this->slug = 'et_pb_social_media_follow';
$this->vb_support = 'on';
$this->child_slug = 'et_pb_social_media_follow_network';
$this->child_item_text = esc_html__( 'Social Network', 'et_builder' );
$this->main_css_element = 'ul%%order_class%%';
$this->settings_modal_toggles = array(
'icon' => esc_html__( 'Icon', 'et_builder' ),
'alignment' => esc_html__( 'Alignment', 'et_builder' ),
'icon' => esc_html__( 'Icon', 'et_builder' ),
'text' => et_builder_i18n( 'Text' ),
$this->custom_css_fields = array(
'label' => et_builder_i18n( 'Before' ),
'selector' => 'ul%%order_class%%:before',
'label' => et_builder_i18n( 'Main Element' ),
'selector' => 'ul%%order_class%%',
'label' => et_builder_i18n( 'After' ),
'selector' => 'ul%%order_class%%:after',
'social_follow' => array(
'label' => esc_html__( 'Social Follow', 'et_builder' ),
'label' => esc_html__( 'Social Icon', 'et_builder' ),
'selector' => 'li a.icon',
'follow_button' => array(
'label' => esc_html__( 'Follow Button', 'et_builder' ),
'selector' => 'li a.follow_button',
$this->advanced_fields = array(
'border_radii' => "{$this->main_css_element} a.icon",
'border_styles' => "{$this->main_css_element} a",
'border_radii' => 'on|3px|3px|3px|3px',
'border_styles' => array(
'main' => '%%order_class%% .et_pb_social_icon a',
'margin_padding' => array(
'main' => 'ul%%order_class%%',
'important' => array( 'custom_margin', 'custom_padding' ), // needed to overwrite last module margin-bottom styling and default ul padding on post
'use_background_layout' => true,
'text_orientation' => array(
'exclude_options' => array( 'justified' ),
'text_orientation' => array(
'label' => esc_html__( 'Module Alignment', 'et_builder' ),
'toggle_slug' => 'alignment',
'options_icon' => 'module_align',
'background_layout' => array(
'label' => esc_html__( 'Follow Button', 'et_builder' ),
'main' => "{$this->main_css_element} .follow_button",
'hide_custom_padding' => true,
'main' => "{$this->main_css_element} .follow_button",
$this->help_videos = array(
'name' => esc_html__( 'An introduction to the Social Media Follow module', 'et_builder' ),
'url_new_window' => array(
'label' => esc_html__( 'Link Target', 'et_builder' ),
'option_category' => 'configuration',
'off' => esc_html__( 'In The Same Window', 'et_builder' ),
'on' => esc_html__( 'In The New Tab', 'et_builder' ),
'description' => esc_html__( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
'default_on_front' => 'on',
'follow_button' => array(
'label' => esc_html__( 'Follow Button', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'off' => et_builder_i18n( 'Off' ),
'on' => et_builder_i18n( 'On' ),
'default_on_front' => 'off',
'description' => esc_html__( 'Here you can choose whether or not to include the follow button next to the icon.', 'et_builder' ),
'mobile_options' => true,
'label' => esc_html__( 'Icon Color', 'et_builder' ),
'description' => esc_html__( 'Here you can define a custom color for the social network icon.', 'et_builder' ),
'tab_slug' => 'advanced',
'mobile_options' => true,
'use_icon_font_size' => array(
'label' => esc_html__( 'Use Custom Icon Size', 'et_builder' ),
'description' => esc_html__( 'If you would like to control the size of the icon, you must first enable this option.', 'et_builder' ),
'type' => 'yes_no_button',
'off' => et_builder_i18n( 'No' ),
'on' => et_builder_i18n( 'Yes' ),
'default_on_front' => 'off',
'depends_show_if' => 'on',
'tab_slug' => 'advanced',
'option_category' => 'font_option',
'icon_font_size' => array(
'label' => esc_html__( 'Icon Font Size', 'et_builder' ),
'description' => esc_html__( 'Control the size of the icon by increasing or decreasing the font size.', 'et_builder' ),
'option_category' => 'font_option',
'tab_slug' => 'advanced',
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'default_on_front' => '',
'range_settings' => array(
'mobile_options' => true,
'depends_show_if' => 'on',
public function get_transition_fields_css_props() {
$fields = parent::get_transition_fields_css_props();
$fields['icon_color'] = array( 'color' => '%%order_class%% li a.icon:before' );
$fields['icon_font_size'] = array(
'font-size' => '%%order_class%% li a.icon:before',
'line-height' => '%%order_class%% li a.icon:before',
'height' => '%%order_class%% li a.icon:before',
'width' => '%%order_class%% li a.icon:before',
'height' => '%%order_class%% li a.icon',
'width' => '%%order_class%% li a.icon',
function before_render() {
global $et_pb_social_media_follow_link,
$et_pb_social_media_follow_sticky;
$url_new_window = $this->props['url_new_window'];
$follow_button = et_pb_multi_view_options( $this )->get_values( 'follow_button' );
$et_pb_social_media_follow_link = array(
'url_new_window' => $url_new_window,
'follow_button' => $follow_button,
$et_pb_social_media_follow_sticky = et_pb_sticky_options()->is_sticky_module( $this->props );
* Renders the module output.
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
public function render( $attrs, $content, $render_slug ) {
global $et_pb_social_media_follow_link;
$multi_view = et_pb_multi_view_options( $this );
$video_background = $this->video_background();
$parallax_image_background = $this->get_parallax_image_background();
$use_icon_font_size = $this->props['use_icon_font_size'];
$icon_font_size_values = et_pb_responsive_options()->get_property_values( $this->props, 'icon_font_size' );
'base_attr_name' => 'icon_color',
'selector' => '%%order_class%% li.et_pb_social_icon a.icon:before',
'selector_wrapper' => '%%order_class%% li a.icon',
'hover_pseudo_selector_location' => 'suffix',
'sticky_pseudo_selector_location' => 'prefix',
'css_property' => 'color',
'render_slug' => $render_slug,
if ( 'off' !== $use_icon_font_size ) {
// Calculate icon size + its wrapper dimension.
'base_attr_name' => 'icon_font_size',
'selector' => '%%order_class%% li a.icon:before',
'selector_wrapper' => '%%order_class%% li a.icon',
'hover_pseudo_selector_location' => 'suffix',
'sticky_pseudo_selector_location' => 'prefix',
'render_slug' => $render_slug,
'css_property' => 'right',
// processed attr value can't be directly assigned to single css property so
// custom processor is needed to render this attr.
'ET_Builder_Module_Helper_Style_Processor',
'process_social_media_icon_font_size',
// Get custom borders, if any
$this->get_text_orientation_classname(),
// Background layout class names.
$background_layout_class_names = et_pb_background_layout_options()->get_background_layout_class( $this->props );
$this->add_classname( $background_layout_class_names );
if ( $multi_view->has_value( 'follow_button', 'on' ) ) {
$this->add_classname( 'has_follow_button' );
// Background layout data attributes.
$data_background_layout = et_pb_background_layout_options()->get_background_layout_attrs( $this->props );
$muti_view_data_attr = $multi_view->render_attrs(
'has_follow_button' => array(
'<ul%3$s class="%2$s"%6$s%7$s>
</ul> <!-- .et_pb_counters -->',
$this->module_classname( $render_slug ),
$parallax_image_background, // #5
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $muti_view_data_attr )
new ET_Builder_Module_Social_Media_Follow();