/** * Register UI for Shortcake. * * @since 1.0.0 */ function mm_components_mm_custom_heading_shortcode_ui() { if (!function_exists('shortcode_ui_register_for_shortcode')) { return; } $heading_levels = mm_get_heading_levels('mm-custom-heading'); $fonts = mm_get_fonts('mm-custom-heading'); $font_weights = mm_get_font_weights('mm-custom-heading'); $colors = mm_get_colors('mm-custom-heading'); $text_alignments = mm_get_text_alignment('mm-custom-heading'); $link_targets = mm_get_link_targets('mm-custom-heading'); shortcode_ui_register_for_shortcode('mm_custom_heading', array('label' => esc_html__('Mm Custom Heading', 'mm-components'), 'listItemImage' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'attrs' => array(array('label' => esc_html__('Heading Text', 'mm-components'), 'attr' => 'heading_text', 'type' => 'text'), array('label' => esc_html__('Heading Level', 'mm-components'), 'attr' => 'heading', 'type' => 'select', 'options' => $heading_levels), array('label' => esc_html__('Font', 'mm-components'), 'attr' => 'font_family', 'type' => 'select', 'options' => $fonts), array('label' => esc_html__('Font Size', 'mm-components'), 'description' => esc_html__('Leave blank to use default heading size, or specify a number of pixels. Example: 16', 'mm-components'), 'attr' => 'size', 'type' => 'text'), array('label' => esc_html__('Font Weight', 'mm-components'), 'attr' => 'weight', 'type' => 'select', 'options' => $font_weights), array('label' => esc_html__('Text Transform', 'mm-components'), 'attr' => 'text_transform', 'type' => 'select', 'options' => array('' => esc_html__('None', 'mm-components '), 'uppercase' => esc_html__('Uppercase', 'mm-components '))), array('label' => esc_html__('Text Align', 'mm-components'), 'attr' => 'alignment', 'type' => 'select', 'options' => $text_alignments), array('heading' => esc_html__('Color', 'mm-components'), 'attr' => 'color', 'type' => 'select', 'options' => $colors), array('label' => esc_html__('Margin Bottom', 'mm-components'), 'description' => esc_html__('Leave blank to use default margin, or specify a number of pixels. Example: 16', 'mm-components'), 'attr' => 'margin_bottom', 'type' => 'text'), array('label' => esc_html__('Heading Link', 'mm-components'), 'attr' => 'link', 'type' => 'url'), array('label' => esc_html__('Heading Link Target', 'mm-components'), 'attr' => 'link_target', 'type' => 'select', 'options' => $link_targets)))); }
/** * Return an array of 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 colors. */ function mm_get_colors_for_vc($context = '') { return array_flip(mm_get_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('image' => '', 'image_card_style' => 'button-bottom', 'image_size' => '', 'image_text' => '', 'image_text_color' => '', 'link_image' => '', 'link' => '', 'link_target' => '_self', 'content_align' => 'default', 'button_link' => '', 'button_link_target' => '', '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); $image = $instance['image']; $image_card_style = $instance['image_card_style']; $image_size = $instance['image_size']; $image_text = $instance['image_text']; $image_text_color = $instance['image_text_color']; $link_image = $instance['link_image']; $link = $instance['link']; $link_target = $instance['link_target']; $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']; // Image. $this->field_single_media(__('Image', 'mm-components'), __('Upload an image that is large enough to be output without stretching', 'mm-components'), $classname . '-image widefat', 'image', $image); // Image Card Style. $this->field_select(__('Image Card Style', 'mm-components'), '', $classname . '-image-card-style widefat', 'image_card_style', $image_card_style, mm_get_image_card_styles('mm-image-card')); // Link text. $this->field_text(__('Link', 'mm-components'), '', $classname . '-link widefat', 'link', $link); // Image Size. $this->field_select(__('Image Size', 'mm-components'), '', $classname . '-image-size widefat', 'image_size', $image_size, mm_get_image_sizes('mm-image-card')); // Image Text. $this->field_text(__('Image Text', 'mm-components'), '', $classname . '-image-text widefat', 'image_text', $image_text); // Image Text Color. $this->field_select(__('Image Text Color', 'mm-components'), '', $classname . '-image-text-color widefat', 'image_text_color', $image_text_color, mm_get_colors('mm-image-card')); // Link Image. $this->field_checkbox(__('Link Image?', 'mm-components'), '', $classname . '-link-image widefat', 'link_image', $link_image); // Link target. $this->field_select(__('Link Target', 'mm-components'), '', $classname . '-link-target widefat', 'button_link_target', $button_link_target, mm_get_link_targets('mm-button')); // Content align. $this->field_select(__('Content Alignment', 'mm-components'), '', $classname . '-content-align widefat', 'content_align', $content_align, mm_get_text_alignment('mm-image-card')); // Button text. $this->field_text(__('Button Text', 'mm-components'), '', $classname . '-button-text widefat', 'button_text', $button_text); // 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 color. $this->field_select(__('Button Color', 'mm-components'), '', $classname . '-button-color widefat', 'button_color', $button_color, mm_get_colors('mm-button')); }
/** * 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']); } }
/** * Output the Widgets settings form. * * @since 1.0.0 * * @param array $instance The options for the widget instance. */ public function form($instance) { $defaults = array('title' => '', 'link' => '', 'button_text' => '', 'style' => '', 'corner_style' => '', 'border_weight' => '', 'color' => '', 'size' => '', 'full_width' => '', 'alignment' => ''); // Use our instance args if they are there, otherwise use the defaults. $instance = wp_parse_args($instance, $defaults); $title = $instance['title']; $link = $instance['link']; $button_text = $instance['button_text']; $style = $instance['style']; $corner_style = $instance['corner_style']; $border_weight = $instance['border_weight']; $color = $instance['color']; $size = $instance['size']; $full_width = mm_true_or_false($instance['full_width']); $alignment = $instance['alignment']; $classname = $this->options['classname']; $colors = mm_get_colors('mm-button'); $text_alignment = mm_get_text_alignment('mm-button'); // Handle the case of a newly added widget that doesn't yet have button text set. $preview_instance = $instance; if ('' == $preview_instance['button_text']) { $preview_instance['button_text'] = __('Button Text', 'mm-components'); } // Title. $this->field_text(__('Title', 'mm-components'), '', $classname . '-title widefat', 'title', $title); // Preview. $this->field_custom(__('Button Preview', 'mm-components'), '', '<div class="mm-button-preview-wrap">' . mm_button($preview_instance) . '</div>'); // Button text. $this->field_text(__('Button Text', 'mm-components'), '', $classname . '-button-text widefat', 'button_text', $button_text); // Link. $this->field_text(__('Button Link', 'mm-components'), '', $classname . '-link widefat', 'link', $link); // Button style. $this->field_select(__('Button Style', 'mm-components'), '', $classname . '-style widefat', 'style', $style, array('default' => __('Default', 'mm-components'), 'ghost' => __('Ghost', 'mm-components'), 'solid-to-ghost' => __('Solid to Ghost', 'mm-components'), 'three-d' => __('3D', 'mm-components'), 'gradient' => __('Gradient', 'mm-components'))); // Corner style. $this->field_select(__('Corner Style', 'mm-components'), '', $classname . '-corner-style widefat', 'corner_style', $corner_style, array('pointed' => __('Pointed', 'mm-components'), 'rounded' => __('Rounded', 'mm-components'), 'pill' => __('Pill', 'mm-components'))); // Border weight. $this->field_select(__('Border Weight', 'mm-components'), '', $classname . 'border-weight widefat', 'border_weight', $border_weight, array('thin' => __('Thin', 'mm-components'), 'thick' => __('Thick', 'mm-components'))); // Color. $this->field_select(__('Color', 'mm-components'), '', $classname . '-color widefat', 'color', $color, $colors); // Size. $this->field_select(__('Size', 'mm-components'), '', $classname . '-size widefat', 'size', $size, array('normal' => __('Normal', 'mm-components'), 'small' => __('Small', 'mm-components'), 'large' => __('Large', 'mm-components'))); // Full width. $this->field_checkbox(__('Full Width', 'mm-components'), __('Choosing full-width will make the button take up the width of its container.', 'mm-components'), $classname . '-full-width widefat', 'full_width', $full_width); // Alignment. $this->field_select(__('Button Alignment', 'mm-components'), '', $classname . '-alignment widefat', 'alignment', $alignment, $text_alignment); }
/** * 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); }
/** * 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); }