Move create form to only show in list
This commit is contained in:
@@ -103,7 +103,6 @@
|
||||
// Display custom fields
|
||||
$custom_fields = go_form_get_custom_fields($form_id);
|
||||
foreach ($custom_fields as $field):
|
||||
if (!$field->is_public) continue;
|
||||
$field_id = 'custom_field_' . $field->id;
|
||||
echo '<div' . ($field->field_type === 'checkbox' ? ' style="grid-column: span 2;"' : '') . '>';
|
||||
echo '<label for="' . esc_attr($field_id) . '">' . esc_html($field->field_name) . ($field->is_required ? '*' : '') . ':</label>';
|
||||
|
||||
@@ -24,23 +24,6 @@ if (isset($_GET['error']) && $_GET['error'] == 'missing_required_field')
|
||||
<div class="wrap">
|
||||
<h1>Go Form Settings</h1>
|
||||
|
||||
<h2>Create New Form</h2>
|
||||
<form method="post" action=" <?= admin_url('admin-post.php') ?> ">
|
||||
<?= wp_nonce_field('go_form_create_form_action', 'go_form_create_form_nonce', true, false) ?>
|
||||
<input type="hidden" name="action" value="go_form_create_form">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th>
|
||||
<label for="form_name">Form Name:</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="form_name" id="form_name" required>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="submit"><input type="submit" class="button button-primary" value="Create Form"></p>
|
||||
</form>
|
||||
|
||||
<h2>Manage Forms & Entries</h2>
|
||||
|
||||
<?php
|
||||
@@ -221,6 +204,16 @@ if (isset($_GET['error']) && $_GET['error'] == 'missing_required_field')
|
||||
|
||||
} else {
|
||||
|
||||
echo '<h2>Create New Form</h2>';
|
||||
echo '<form method="post" action="' . admin_url('admin-post.php') . '">';
|
||||
echo wp_nonce_field('go_form_create_form_action', 'go_form_create_form_nonce', true, false);
|
||||
echo '<input type="hidden" name="action" value="go_form_create_form">';
|
||||
echo '<table class="form-table">';
|
||||
echo '<tr><th><label for="form_name">Form Name:</label></th><td><input type="text" name="form_name" id="form_name" required></td></tr>';
|
||||
echo '</table>';
|
||||
echo '<p class="submit"><input type="submit" class="button button-primary" value="Create Form"></p>';
|
||||
echo '</form>';
|
||||
|
||||
$forms = go_form_get_forms();
|
||||
echo '<h3>Forms</h3><ul>';
|
||||
foreach ($forms as $f) {
|
||||
|
||||
Reference in New Issue
Block a user