summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-05-24 21:09:34 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-05-24 21:09:34 +0200
commit0d3a225b3203b8a8fe0ad24138c09a4f1f738f54 (patch)
treec0c8d29f981698e4a44993bb688e0889bb9200ac /includes
parent9694c61f301989cdbbfd9e303e74b30812752cab (diff)
downloadgigologadmin-0d3a225b3203b8a8fe0ad24138c09a4f1f738f54.tar.gz
gigologadmin-0d3a225b3203b8a8fe0ad24138c09a4f1f738f54.tar.bz2
gigologadmin-0d3a225b3203b8a8fe0ad24138c09a4f1f738f54.zip
Use select_field for venue selector in new/edit form
Diffstat (limited to 'includes')
-rw-r--r--includes/admin/views/giglog_admin_page.php17
1 files changed, 4 insertions, 13 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php
index 9d9d759..7de52ce 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/giglog_admin_page.php
@@ -38,19 +38,10 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
static function get_venue_selector( ?GiglogAdmin_Venue $invenue ): string
{
- $select = '<select name="selectvenueadmin">';
- $select .= '<option value="">Please Select..</option>';
- foreach ( GiglogAdmin_Venue::all_venues() AS $venue ) {
- if($invenue && $invenue->id() == $venue->id() ) {
- $select .= '<option value="' . $venue->id(). '" selected="selected">'.$venue->name();
- }
- else {
- $select .= '<option value="' . $venue->id() . '">'. $venue->name();
- }
- $select .='</option>';
- }
- $select .= '</select>';
- return($select);
+ return \EternalTerror\ViewHelpers\select_field(
+ "selectvenueadmin",
+ array_map(fn($venue) => [$venue->id(), $venue->name()], GiglogAdmin_Venue::all_venues()),
+ $invenue ? $invenue->id() : null);
}