Example #1
0
 public function page_handler()
 {
     // Following code taken from the legacy parts. Needs refactoring.
     // By now we expect that prepare_form_maybe_redirect() was already called. If not, something went terribly wrong.
     if (null == $this->wpcf_admin) {
         return;
     }
     // Well this doesn't look right.
     $post_type = current_filter();
     // Start rendering the page.
     // Header and title
     $page_purpose = $this->wpcf_admin->get_page_purpose();
     $add_new_button = 'edit' == $page_purpose ? array('page' => self::PAGE_NAME) : false;
     wpcf_add_admin_header($this->get_page_title($page_purpose), $add_new_button);
     // Display WPML admin notices if there are any.
     wpcf_wpml_warning();
     // Transform the form data into an Enlimbo form
     $form = wpcf_form(self::FORM_NAME, $this->form);
     // Dark magic happens here.
     echo '<form method="post" action="" class="wpcf-fields-form wpcf-form-validate js-types-show-modal">';
     wpcf_admin_screen($post_type, $form->renderForm());
     echo '</form>';
     wpcf_add_admin_footer();
 }
/**
 * Menu page display.
 */
function wpcf_admin_menu_edit_tax()
{
    $post_type = current_filter();
    $title = __('View Taxonomy', 'wpcf');
    $add_new = false;
    if (WPCF_Roles::user_can_create('custom-taxonomy')) {
        $title = __('Add New Taxonomy', 'wpcf');
        if (isset($_GET['wpcf-tax'])) {
            $title = __('Edit Taxonomy', 'wpcf');
            $add_new = array('page' => 'wpcf-edit-tax');
        }
    }
    wpcf_add_admin_header($title, $add_new);
    wpcf_wpml_warning();
    $form = wpcf_form('wpcf_form_tax');
    echo '<form method="post" action="" class="wpcf-tax-form wpcf-form-validate js-types-show-modal">';
    wpcf_admin_screen($post_type, $form->renderForm());
    echo '</form>';
    wpcf_add_admin_footer();
}
Example #3
0
/**
 * Menu page display.
 */
function wpcf_admin_menu_edit_tax()
{
    if (isset($_GET['wpcf-tax'])) {
        $title = __('Edit Taxonomy', 'wpcf');
    } else {
        $title = __('Add New Taxonomy', 'wpcf');
    }
    echo wpcf_add_admin_header($title);
    wpcf_wpml_warning();
    $form = wpcf_form('wpcf_form_tax');
    echo '<br /><form method="post" action="" class="wpcf-tax-form ' . 'wpcf-form-validate">';
    echo $form->renderForm();
    echo '</form>';
    echo wpcf_add_admin_footer();
}
Example #4
0
/**
 * Menu page display.
 */
function wpcf_admin_menu_edit_tax()
{
    if (isset($_GET['wpcf-tax'])) {
        $title = __('Edit Taxonomy', 'wpcf');
        /**
         * add new CPT link
         */
        $title .= sprintf('<a href="%s" class="add-new-h2">%s</a>', add_query_arg('page', 'wpcf-edit-tax', admin_url('admin.php')), __('Add New'));
    } else {
        $title = __('Add New Taxonomy', 'wpcf');
    }
    wpcf_add_admin_header($title);
    wpcf_wpml_warning();
    $form = wpcf_form('wpcf_form_tax');
    echo '<br /><form method="post" action="" class="wpcf-tax-form ' . 'wpcf-form-validate">';
    echo $form->renderForm();
    echo '</form>';
    wpcf_add_admin_footer();
}