/** * Return an array of button corner style options 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 button corner style options. */ function mm_get_button_corner_styles_for_vc($context = '') { return array_flip(mm_get_button_corner_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('link_style' => '', 'link_text' => '', 'link_alignment' => '', 'fade' => '', 'button_style' => '', 'button_border_weight' => '', 'button_corner_style' => '', 'button_color' => '', 'content' => '', 'mm_custom_class' => ''); // Use our instance args if they are there, otherwise use the defaults. $instance = wp_parse_args($instance, $defaults); $link_style = $instance['link_style']; $link_text = $instance['link_text']; $link_alignment = $instance['link_alignment']; $fade = $instance['fade']; $button_style = $instance['button_style']; $button_border_weight = $instance['button_border_weight']; $button_corner_style = $instance['button_corner_style']; $button_color = $instance['button_color']; $content = $instance['content']; $mm_custom_class = $instance['mm_custom_class']; $classname = $this->options['classname']; // Link Style. $this->field_select(__('Button or Link?', 'mm-components'), 'Should the trigger be a button or a link?', $classname . '-link-style widefat', 'link_style', $link_style, array(__('Select Button or Link', 'mm-components'), 'button' => __('Button', 'mm-components'), 'link' => __('Link', 'mm-components'))); // Link Text. $this->field_text(__('Button/Link Text', 'mm-components'), '', $classname . '-link-text widefat', 'link_text', $link_text); // Link Alignment. $this->field_select(__('Link Alignment', 'mm-components'), '', $classname . '-link-alignment widefat', 'link_alignment', $link_alignment, mm_get_text_alignment('mm-expandable-content')); // Fade. $this->field_multi_checkbox(__('Fade in?', 'mm-components'), '', $classname . '-fade widefat', 'fade', $fade, array('fade' => 'Yes')); // Button Style. $this->field_select(__('Button Style', 'mm-components'), __('', 'mm-components'), $classname . '-button-style widefat', 'button_style', $button_style, mm_get_button_styles('mm-expandable-content')); // 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-expandable-content')); // Button Corner Syles. $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-expandable-content')); // Button Color. $this->field_select(__('Button Color', 'mm-components'), '', $classname . '-button-color widefat', 'button_color', $button_color, mm_get_colors('mm-expandable-content')); // Expandable Content. $this->field_textarea(__('Content to be expanded', 'mm-components'), '', $classname . '-content widefat', 'content', $content); // Custom class. $this->field_text(__('Custom class:', 'mm-components'), '', $classname . '-mm-custom-class widefat', 'mm_custom_class', $mm_custom_class); }
/** * Register UI for Shortcake. * * @since 1.0.0 */ function mm_components_mm_button_shortcode_ui() { if (!function_exists('shortcode_ui_register_for_shortcode')) { return; } $link_targets = mm_get_link_targets('mm-button'); $button_styles = mm_get_button_styles('mm-button'); $button_border_weights = mm_get_button_border_weights('mm-button'); $button_corner_styles = mm_get_button_corner_styles('mm-button'); $colors = mm_get_colors('mm-button'); $text_alignments = mm_get_text_alignment('mm-button'); shortcode_ui_register_for_shortcode('mm_button', array('label' => esc_html__('Mm Button', 'mm-components'), 'listItemImage' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'attrs' => array(array('label' => esc_html('Button Text', 'mm-components'), 'description' => esc_html__('Enter the button text.', 'mm-components'), 'attr' => 'button_text', 'type' => 'text'), array('label' => esc_html__('URL', 'mm-components'), 'description' => esc_html__('Enter the full URL for the button.', 'mm-components'), 'attr' => 'link', 'type' => 'url'), array('label' => esc_html('Link Title', 'mm-components'), 'attr' => 'link_title', 'type' => 'text'), array('label' => esc_html('Link Target', 'mm-components'), 'attr' => 'link_target', 'type' => 'select', 'options' => $link_targets), array('label' => esc_html__('Style', 'mm-components'), 'attr' => 'style', 'type' => 'select', 'options' => $button_styles), array('label' => esc_html__('Border Weight', 'mm-components'), 'attr' => 'border_weight', 'type' => 'select', 'options' => $button_border_weights), array('label' => esc_html__('Corner Style', 'mm-components'), 'attr' => 'corner_style', 'type' => 'select', 'options' => $button_corner_styles), array('label' => esc_html__('Color', 'mm-components'), 'attr' => 'color', 'type' => 'select', 'options' => $colors), array('label' => esc_html__('Button Size', 'mm-components'), 'attr' => 'size', 'type' => 'select', 'options' => array('normal-size' => esc_html__('Normal', 'mm-components'), 'small' => esc_html__('Small', 'mm-components'), 'large' => esc_html__('Large', 'mm-components'))), array('label' => esc_html__('Button Alignment', 'mm-components'), 'attr' => 'alignment', 'type' => 'select', 'options' => $text_alignments), array('label' => esc_html__('Full Width Button?', 'mm-button'), 'description' => esc_html__('Choosing full-width will make the button take up the width of its container', 'mm-components'), 'attr' => 'full_width', 'type' => 'checkbox'), array('label' => esc_html('Class', 'mm-components'), 'description' => esc_html__('List any CSS classes you would like to add.', 'mm-components'), 'attr' => 'class', 'type' => 'text')))); }
/** * 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); }