/** * form function. * * @see WP_Widget->form * @access public * @param array $instance * @return void */ public function form($instance) { $defaults = array('title' => __('Quick Contact', 'yit'), 'text' => __('Need a quick reply to your questions? Fill the form, we will reply in max 24h.', 'yit'), 'id_form' => '', 'button_style' => 'btn btn-flat'); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'yit'); ?> : <input type="text" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo $instance['title']; ?> " class="widefat" /> </label> </p> <p> <label for="<?php echo $this->get_field_id('text'); ?> "><?php _e('Text', 'yit'); ?> : <textarea id="<?php echo $this->get_field_id('text'); ?> " name="<?php echo $this->get_field_name('text'); ?> " class="widefat"><?php echo $instance['text']; ?> </textarea> </label> </p> <p> <?php _e('Select here the form that you have created and configurated on Theme Options panel.', 'yit'); ?> </p> <p> <label for="<?php echo $this->get_field_id('label_name'); ?> "><?php _e('Label Name', 'yit'); ?> : <select id="<?php echo $this->get_field_id('id_form'); ?> " name="<?php echo $this->get_field_name('id_form'); ?> "> <?php $forms = yit_get_contact_forms(); foreach ($forms as $id_form => $form) { echo "<option value=\"{$id_form}\"" . ($instance['id_form'] == $id_form ? ' selected="selected"' : '') . ">{$form}</option>\n"; } ?> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('button_style'); ?> "><?php _e('Button Style', 'yit'); ?> : <select id="<?php echo $this->get_field_id('button_style'); ?> " name="<?php echo $this->get_field_name('button_style'); ?> "> <option value="btn btn-flat" <?php selected('btn btn-flat', $instance['button_style']); ?> ><?php _e('Flat', 'yit'); ?> </option> <option value="btn btn-alternative" <?php selected('btn btn-alternative', $instance['button_style']); ?> ><?php _e('Alternative', 'yit'); ?> </option> </select> </label> </p> <?php }
/** * form function. * * @see WP_Widget->form * @access public * @param array $instance * @return void */ public function form($instance) { $defaults = array('title' => __('Quick Contact', 'yit'), 'text' => __('Need a quick reply to your questions? Fill the form, we will reply in max 24h.', 'yit'), 'id_form' => '', 'button_style' => 'btn btn-flat'); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php _e('Title', 'yit'); ?> : <input type="text" id="<?php echo esc_attr($this->get_field_id('title')); ?> " name="<?php echo esc_attr($this->get_field_name('title')); ?> " value="<?php echo esc_attr($instance['title']); ?> " class="widefat" /> </label> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('text')); ?> "><?php _e('Text', 'yit'); ?> : <textarea id="<?php echo esc_attr($this->get_field_id('text')); ?> " name="<?php echo esc_attr($this->get_field_name('text')); ?> " class="widefat"><?php echo $instance['text']; ?> </textarea> </label> </p> <p> <?php _e('Select here the form that you have created and configurated on Theme Options panel.', 'yit'); ?> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('label_name')); ?> "><?php _e('Contact Form ', 'yit'); ?> : <select id="<?php echo esc_attr($this->get_field_id('id_form')); ?> " name="<?php echo esc_attr($this->get_field_name('id_form')); ?> "> <?php $forms = yit_get_contact_forms(); foreach ($forms as $id_form => $form) { ?> <option value="<?php echo esc_attr($id_form); ?> " <?php selected($instance['id_form'], $id_form); ?> ><?php echo $form; ?> </option> <?php } ?> </select> </label> </p> <?php }