/** * @param array $settings * @param WP_Widget $widget */ public function widget_form($settings, WP_Widget $widget) { $forms = mc4wp_get_forms(); ?> <p> <label for="<?php echo $widget->get_field_id('form_id'); ?> "><?php _e('Form:', 'mailchimp-for-wp'); ?> </label> <select class="widefat" name="<?php echo $widget->get_field_name('form_id'); ?> " id="<?php echo $widget->get_field_id('form_id'); ?> "> <option value="0" disabled <?php selected($settings['form_id'], 0); ?> ><?php _e('Select the form to show', 'mailchimp-for-wp'); ?> </option> <?php foreach ($forms as $f) { ?> <option value="<?php echo esc_attr($f->ID); ?> " <?php selected($settings['form_id'], $f->ID); ?> ><?php echo esc_html($f->name); ?> </option> <?php } ?> </select> </p> <?php if (empty($forms)) { ?> <p class="help"><?php printf(__('You don\'t have any sign-up forms. <a href="%s">Would you like to create one now?</a>', 'mailchimp-for-wp'), mc4wp_get_add_form_url()); ?> </p> <?php } }
public function show_new_form_button() { ?> <a href="<?php echo mc4wp_get_add_form_url(); ?> " class="page-title-action"> <span class="dashicons dashicons-plus-alt" style=""></span> <?php _e('Add new form', 'mailchimp-for-wp'); ?> </a> <?php }
/** * Redirect to correct form action * * @ignore */ public function redirect_to_form_action() { if (!empty($_GET['view'])) { return; } // query first available form and go there $forms = mc4wp_get_forms(array('numberposts' => 1)); if ($forms) { // if we have a post, go to the "edit form" screen $form = array_pop($forms); $redirect_url = mc4wp_get_edit_form_url($form->ID); } else { // we don't have a form yet, go to "add new" screen $redirect_url = mc4wp_get_add_form_url(); } wp_redirect($redirect_url); exit; }
</span> <a href="<?php echo admin_url('admin.php?page=mailchimp-for-wp'); ?> ">MailChimp for WordPress</a> › <span class="current-crumb"><strong><?php _e('Forms', 'mailchimp-for-wp'); ?> </strong></span> </p> <h1 class="page-title"><?php _e('Forms', 'mailchimp-for-wp'); ?> <a href="<?php echo mc4wp_get_add_form_url(); ?> " class="page-title-action"> <span class="dashicons dashicons-plus-alt" style=""></span> <?php _e('Add new form', 'mailchimp-for-wp'); ?> </a> <?php if ($search_query) { printf(' <span class="subtitle">' . __('Search results for “%s”') . '</span>', $search_query); } ?> </h1>
/** * The text that is shown when there are no items to show */ public function no_items() { echo sprintf(__('No forms found. <a href="%s">Would you like to create one now</a>?', 'mailchimp-for-wp'), mc4wp_get_add_form_url()); }