/** * Return an array of icon styles for use in a Visual Composer param. * * @since 1.0.0 * * @param string $context The context to pass to our filter. * * @return array The array of social networks. */ function mm_get_icon_styles_for_vc($context = '') { return array_flip(mm_get_icon_styles($context)); }
/** * Output the Widget settings form. * * @since 1.0.0 * * @param array $instance The options for the widget instance. */ public function form($instance) { $defaults = array('title' => '', 'icon_type' => 'fontawesome', 'image_size' => 'thumbnail', 'alignment' => 'left', 'style' => 'icon-only', 'ghost' => '', 'color' => '', 'size' => 'normal-size', 'mm_custom_class' => ''); $colors = mm_get_colors('mm-social-icons'); // Add our brand colors option. $brand_colors = array('brand-colors' => __('Brand Colors', 'mm-components')); $colors = array_merge($colors, $brand_colors); $social_networks = mm_get_social_networks('mm-social-icons'); foreach ($social_networks as $social_network => $social_network_label) { $defaults[$social_network . '_link'] = ''; $defaults[$social_network . '_image'] = ''; } // Use our instance args if they are there, otherwise use the defaults. $instance = wp_parse_args($instance, $defaults); $title = $instance['title']; $icon_type = $instance['icon_type']; $image_size = $instance['image_size']; $alignment = $instance['alignment']; $style = $instance['style']; $ghost = $instance['ghost']; $color = $instance['color']; $size = $instance['size']; $classname = $this->options['classname']; // Title. $this->field_text(__('Title', 'mm-components'), '', $classname . '-title widefat', 'title', $title); // Icon Type. $this->field_select(__('Icon Type', 'mm-components'), '', $classname . '-icon-type widefat', 'icon_type', $icon_type, mm_get_social_icons_types('mm-social-icons')); // Image Size. $this->field_select(__('Image Size', 'mm-components'), '', $classname . '-image-size widefat', 'image_size', $image_size, mm_get_image_sizes('mm-social-icons')); // Icon Alignment. $this->field_select(__('Icon Alignment', 'mm-components'), '', $classname . '-alignment widefat', 'alignment', $alignment, mm_get_text_alignment('mm-social-icons')); // Icon Style. $this->field_select(__('Icon Style', 'mm-components'), '', $classname . '-style widefat', 'style', $style, mm_get_icon_styles('mm-social-icons')); // Ghost Mode. $this->field_multi_checkbox(__('Ghost Mode', 'mm-components'), '', $classname . '-ghost-mode widefat', 'ghost', $ghost, array('yes' => __('Yes', 'mm-components'))); // Icon size. $this->field_select(__('Icon Size', 'mm-components'), '', $classname . '-size widefat', 'size', $size, array('' => __('Normal', 'mm-components'), 'small' => __('Small', 'mm-components'), 'large' => __('Large', 'mm-components'))); // Icon color. $this->field_select(__('Icon Color', 'mm-components'), '', $classname . '-color widefat', 'color', $color, $colors); foreach ($social_networks as $social_network => $social_network_label) { // Social Network Link. $this->field_text(__($social_network_label . ' URL', 'mm-components'), '', $classname . '-social-network-link widefat', $social_network . '_link', $instance[$social_network . '_link']); // Social Network Image. $this->field_single_media(__($social_network_label . ' Image', 'mm-components'), '', $classname . '-social-network-image widefat', $social_network . '_image', $instance[$social_network . '_image']); } }