widget_cssclass = 'widget_applica_mailchimp_form'; $this->widget_description = __("Displays MailChimp form if you have any", 'applica'); $this->widget_id = 'applica_mailchimp_form'; $this->widget_name = __('Applica: MailChimp Form', 'applica'); $this->settings = array( 'title' => array( 'label' => esc_html__('Widget Title', 'applica'), 'type' => 'text', 'class' => 'widefat', ), 'desc' => array( 'type' => 'textarea', 'label' => __('Description', 'applica'), 'rows' => 10, ), 'form_shortcode' => array( 'type' => 'text', 'label' => __('MailChimp Form Shortcode', 'applica'), ), 'style' => array( 'type' => 'select', 'label' => __('Style', 'applica'), 'options' => array( 'style_1' => __('Style 1', 'applica'), 'style_2' => __('Style 2', 'applica'), 'style_3' => __('Style 3', 'applica'), ), 'std' => 'style_1', ), 'msg' => array( 'type' => 'message', 'label' => __('Additonal Settings', 'applica'), ), 'height' => array( 'type' => 'number', 'step' => 20, 'min' => 300, 'max' => 700, 'std' => 400, 'label' => __('Height: Between 300px and 700px (Default 400px)', 'applica'), ), 'text_color_option' => array( 'type' => 'color', 'label' => __('Text Color', 'applica'), 'std' => '#ffffff', ), 'text_align' => array( 'type' => 'select', 'label' => __('Text Alignment', 'applica'), 'options' => array( 'left' => __('Left Align', 'applica'), 'center' => __('Center Align', 'applica'), 'right' => __('Right Align', 'applica'), ), 'std' => 'left', ), 'bg_image' => array( 'type' => 'image', 'label' => __('Background Image', 'applica'), 'desc' => __('Don\'t upload any image if you do not want to show the background image.', 'applica'), ), 'enable_fixed_bg' => array( 'type' => 'checkbox', 'label' => __('Enable Fixed Background Image', 'applica'), 'std' => true, ), 'bg_overlay_color' => array( 'type' => 'color', 'label' => __('Overlay Background Color', 'applica'), 'std' => '#000000', ), 'overlay_opacity' => array( 'type' => 'number', 'step' => 10, 'min' => 0, 'max' => 100, 'std' => 50, 'label' => __('Overlay Opacity (Default 50%)', 'applica'), ), ); parent::__construct(); } /** * Output widget. * * @see WP_Widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { if (!empty($instance['form_shortcode'])) { ob_start(); $class = ''; $image_enabled = false; if ($instance['bg_image'] && 0 != $instance['bg_image']) { $image_enabled = true; $class = 'applica-cover-block '; if ($instance['enable_fixed_bg']) { $class .= 'applica-bg-image applica-bg-attachment-fixed '; } } $class .= $instance['style']; $style_text = 'color:' . $instance['text_color_option'] . ';'; $style_text .= 'text-align:' . $instance['text_align'] . ';'; $style_text .= 'min-height:' . $instance['height'] . 'px;'; echo $args['before_widget']; do_action('applica_before_mailchimp'); ?>