From 3e9633360b1b535443859adee9729fc15ef0d3ad Mon Sep 17 00:00:00 2001 From: gravel Date: Fri, 29 Dec 2023 18:47:45 +0000 Subject: [PATCH] Refactor hardcoded column sort defaults --- sites/+components/tbl-communities.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sites/+components/tbl-communities.php b/sites/+components/tbl-communities.php index 7afa176..9b9cd67 100644 --- a/sites/+components/tbl-communities.php +++ b/sites/+components/tbl-communities.php @@ -23,7 +23,7 @@ return " title='Click to sort by $name.'"; } - // Note: Changing the names displayed requires updating + // Note: Changing the names or columns displayed requires updating // the --expanded-static-column-width and --collapsed-static-column-width CSS variables. $TABLE_COLUMNS = [ @@ -36,9 +36,11 @@ ['id' => "server_icon", 'name' => "Host", 'name_long' => "Server host"], ['id' => "join_url", 'name' => "URL", 'name_long' => "Join URL (for use in-app)"], ]; + + $SERVER_ICON_COLUMN = array_keys(array_filter($TABLE_COLUMNS, function($column){return $column['id'] == "server_icon";}))[0]; ?> - +
$column): ?> id="th_" class="tbl_communities__th">