Esempio n. 1
0
 /**
  * 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' => '', 'title_heading' => 'h2', 'title_alignment' => 'center', 'images' => '', 'image_size' => 'medium');
     // Use our instance args if they are there, otherwise use the defaults.
     $instance = wp_parse_args($instance, $defaults);
     $title = $instance['title'];
     $title_heading = $instance['title_heading'];
     $title_alignment = $instance['title_alignment'];
     $images = $instance['images'];
     $image_size = $instance['image_size'];
     $classname = $this->options['classname'];
     $image_sizes = mm_get_image_sizes('mm-logo-strip');
     $heading_levels = mm_get_heading_levels('mm-logo-strip');
     // Title.
     $this->field_text(__('Title', 'mm-components'), '', $classname . '-title widefat', 'title', $title);
     // Title heading.
     $this->field_select(__('Title Heading Level', 'mm-components'), '', $classname . '-title-heading widefat', 'title_heading', $title_heading, $heading_levels);
     // Title alignment.
     $this->field_select(__('Title Alignment', 'mm-components'), '', $classname . '-title-alignment widefat', 'title_alignment', $title_alignment, array('left' => __('Left', 'mm-components'), 'center' => __('Center', 'mm-components'), 'right' => __('Right', 'mm-components')));
     // Images.
     $this->field_multi_media(__('Images', 'mm-components'), '', $classname . '-images widefat', 'images', $images);
     // Image size.
     $this->field_select(__('Image Size', 'mm-components'), '', $classname . '-image-size widefat', 'image_size', $image_size, $image_sizes);
 }
Esempio n. 2
0
/**
 * 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))));
}
Esempio n. 3
0
/**
 * Return an array of heading levels 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 heading levels.
 */
function mm_get_heading_levels_for_vc($context = '')
{
    $empty_option = array(__('Select a heading level', 'mm-components'));
    return $empty_option + array_flip(mm_get_heading_levels($context));
}
Esempio n. 4
0
 /**
  * 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);
 }