Add complete custom fields implementation and entry editing
- Add custom field CRUD in admin UI (create, read, update, delete) - Display custom fields on frontend form with proper field types - Save custom field values on form submission - Display custom field columns in entries table (admin and public) - Include custom field values in all export formats (CSV, PairGoTh, OpenGotha, McMahon) - Add Edit button and form for entries - Update entry handler to support editing with custom field values - Add success/error notices for all admin actions Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -99,6 +99,40 @@
|
||||
<label for="egd_number">EGD Number:</label><input type="text" name="egd_number" id="egd_number">
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// 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>';
|
||||
|
||||
switch ($field->field_type) {
|
||||
case 'text':
|
||||
echo '<input type="text" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
||||
break;
|
||||
case 'email':
|
||||
echo '<input type="email" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
||||
break;
|
||||
case 'select':
|
||||
$options = $field->field_options ? explode(',', $field->field_options) : [];
|
||||
echo '<select name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
||||
echo '<option value="">-- Select --</option>';
|
||||
foreach ($options as $option) {
|
||||
$option = trim($option);
|
||||
echo '<option value="' . esc_attr($option) . '">' . esc_html($option) . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
break;
|
||||
case 'checkbox':
|
||||
echo '<input type="checkbox" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" value="1"' . ($field->is_required ? ' required' : '') . '>';
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<p>* Required fields</p>
|
||||
@@ -115,9 +149,10 @@
|
||||
<?php
|
||||
$entries = go_form_get_entries($form_id);
|
||||
$entries_count = count($entries);
|
||||
$custom_fields = go_form_get_custom_fields($form_id);
|
||||
?>
|
||||
<h2>Sign-up players: <?= esc_html($entries_count); ?></h2>
|
||||
<?php go_form_render_entries_table($entries); ?>
|
||||
<?php go_form_render_entries_table($entries, false, $custom_fields, $form_id); ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user