/** * Return an array of overlay color names for use in a Visual Composer dropdown param. * * @since 1.0.0 * * @param string $context The context to pass to our filter. * * @return array The array of overlay colors. */ function mm_get_overlay_colors_for_vc($context = '') { return array_flip(mm_get_overlay_colors($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('background_image' => '', 'background_position' => 'center center', 'full_height' => 0, 'min_height' => '360', 'overlay_color' => '', 'overlay_opacity' => '0.1', 'text_color' => 'default', 'heading_level' => 'h2', 'heading_text' => '', 'content' => '', 'secondary_content' => '', 'content_align' => 'left', 'button_link' => '', 'button_link_target' => '_self', 'button_text' => '', 'button_style' => '', 'button_border_weight' => 'default', 'button_corner_style' => '', 'button_color' => ''); // Use our instance args if they are there, otherwise use the defaults. $instance = wp_parse_args($instance, $defaults); $background_image = $instance['background_image']; $background_position = $instance['background_position']; $full_height = $instance['full_height']; $min_height = $instance['min_height']; $overlay_color = $instance['overlay_color']; $overlay_opacity = $instance['overlay_opacity']; $text_color = $instance['text_color']; $heading_level = $instance['heading_level']; $heading_text = $instance['heading_text']; $content = $instance['content']; $secondary_content = $instance['secondary_content']; $content_align = $instance['content_align']; $button_link = $instance['button_link']; $button_link_target = $instance['button_link_target']; $button_text = $instance['button_text']; $button_style = $instance['button_style']; $button_border_weight = $instance['button_border_weight']; $button_corner_style = $instance['button_corner_style']; $button_color = $instance['button_color']; $classname = $this->options['classname']; // Background image. $this->field_single_media(__('Background Image:', 'mm-components'), __('Upload an image that is large enough to be output without stretching.', 'mm-components'), $classname . '-background-image widefat', 'background_image', $background_image); // Background position. $this->field_select(__('Background Position', 'mm-components'), __('', 'mm-components'), $classname . '-background-position widefat', 'background_position', $background_position, mm_get_background_position('mm-hero-banner')); // Full height. $this->field_checkbox(__('Full Height', 'mm-components'), __('Check this to make the Hero Banner as tall as the window.', 'mm-components'), $classname . '-full-height', 'full_height', $full_height); // Minimum height. $this->field_text(__('Minimum Height', 'mm-components'), __('Specify a number of pixels. Default is 360.', 'mm-components'), $classname . '-min-height widefat', 'min_height', $min_height); // Overlay color. $this->field_select(__('Overlay Color', 'mm-components'), '', $classname . '-overlay-color widefat', 'overlay_color', $overlay_color, mm_get_overlay_colors('mm-hero-banner')); // Overlay opacity. $this->field_select(__('Overlay Opacity', 'mm-components'), '', $classname . '-overlay-opacity widefat', 'overlay_opacity', $overlay_opacity, mm_get_overlay_opacity_values('mm-hero-banner')); // Text color. $this->field_select(__('Text Color', 'mm-components'), '', $classname . '-text-color widefat', 'text_color', $text_color, mm_get_colors('mm-hero-banner')); // Heading text. $this->field_text(__('Hero Banner Heading', 'mm-components'), '', $classname . '-heading widefat', 'heading_text', $heading_text); // Heading level. $this->field_select(__('Heading Level', 'mm-components'), '', $classname . '-heading-level widefat', 'heading_level', $heading_level, mm_get_heading_levels('mm-hero-banner')); // Content. $this->field_textarea(__('Hero Banner Content', 'mm-components'), '', $classname . '-content widefat', 'content', $content); // Content align. $this->field_select(__('Content Alignment', 'mm-components'), '', $classname . '-content-align widefat', 'content_align', $content_align, mm_get_text_alignment('mm-hero-banner')); // Button text. $this->field_text(__('Button Text', 'mm-components'), '', $classname . '-button-text widefat', 'button_text', $button_text); // Button link. $this->field_text(__('Button Link', 'mm-components'), '', $classname . '-button-link widefat', 'button_link', $button_link); // Button link target. $this->field_select(__('Button Link Target', 'mm-components'), '', $classname . '-link-target widefat', 'button_link_target', $button_link_target, mm_get_link_targets('mm-button')); // Button style. $this->field_select(__('Button Style', 'mm-components'), '', $classname . '-button-style widefat', 'button_style', $button_style, mm_get_button_styles('mm-button')); // Button border weight. $this->field_select(__('Button Border Weight', 'mm-components'), '', $classname . '-button-border-weight widefat', 'button_border_weight', $button_border_weight, mm_get_button_border_weights('mm-button')); // Button corner style. $this->field_select(__('Button Corner Style', 'mm-components'), '', $classname . '-button-corner-style widefat', 'button_corner_style', $button_corner_style, mm_get_button_corner_styles('mm-button')); // Button color. $this->field_select(__('Button Color', 'mm-components'), '', $classname . '-button-color widefat', 'button_color', $button_color, mm_get_colors('mm-button')); // Secondary content. $this->field_textarea(__('Secondary Content', 'mm-components'), __('Outputs below the main button. Can include HTML markup.', 'mm-components'), $classname . '-secondary-content widefat', 'secondary_content', $secondary_content); }