Move create form to only show in list

This commit is contained in:
2026-05-12 13:17:27 +02:00
parent 2d537f07dd
commit 5c287eceba
2 changed files with 10 additions and 18 deletions

View File

@@ -103,7 +103,6 @@
// Display custom fields // Display custom fields
$custom_fields = go_form_get_custom_fields($form_id); $custom_fields = go_form_get_custom_fields($form_id);
foreach ($custom_fields as $field): foreach ($custom_fields as $field):
if (!$field->is_public) continue;
$field_id = 'custom_field_' . $field->id; $field_id = 'custom_field_' . $field->id;
echo '<div' . ($field->field_type === 'checkbox' ? ' style="grid-column: span 2;"' : '') . '>'; 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>'; echo '<label for="' . esc_attr($field_id) . '">' . esc_html($field->field_name) . ($field->is_required ? '*' : '') . ':</label>';

View File

@@ -24,23 +24,6 @@ if (isset($_GET['error']) && $_GET['error'] == 'missing_required_field')
<div class="wrap"> <div class="wrap">
<h1>Go Form Settings</h1> <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> <h2>Manage Forms & Entries</h2>
<?php <?php
@@ -221,6 +204,16 @@ if (isset($_GET['error']) && $_GET['error'] == 'missing_required_field')
} else { } 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(); $forms = go_form_get_forms();
echo '<h3>Forms</h3><ul>'; echo '<h3>Forms</h3><ul>';
foreach ($forms as $f) { foreach ($forms as $f) {