diff options
| author | Simon Rettberg | 2025-07-14 16:50:29 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2025-07-14 16:50:29 +0200 |
| commit | 83c4bb160cea6e7fbadbe4c0876b754f0acf24c5 (patch) | |
| tree | 96b8955da109cd15998e3a84699abb11627cb2c3 /inc/render.inc.php | |
| parent | [locationinfo] Remove debug spam (diff) | |
| download | slx-admin-83c4bb160cea6e7fbadbe4c0876b754f0acf24c5.tar.gz slx-admin-83c4bb160cea6e7fbadbe4c0876b754f0acf24c5.tar.xz slx-admin-83c4bb160cea6e7fbadbe4c0876b754f0acf24c5.zip | |
[locationinfo] Add UPCOMING panel type
Diffstat (limited to 'inc/render.inc.php')
| -rw-r--r-- | inc/render.inc.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/inc/render.inc.php b/inc/render.inc.php index a636382e..d22379bb 100644 --- a/inc/render.inc.php +++ b/inc/render.inc.php @@ -311,4 +311,22 @@ class Render return sprintf("#%02x%02x%02x", ($chans[0] + $b) / 3, ($chans[1] + $b) / 3, ($chans[2] + $b) / 3); } + /** + * Mangle fields in the params array based on the checked fields. + * $checked is a list of field names that will be checked for true-ness + * in $params, and for each matching field name, a new key named "{$field}_checked" + * will be added to $params with value 'checked'. + * + * @param string[] &$params The array of parameters to be modified + * @param string[] $checked The array of fields to check for true-ness + */ + public static function mangleFields(array &$params, array $checked): void + { + foreach ($checked as $field) { + if (($params[$field] ?? false)) { + $params[$field . '_checked'] = 'checked'; + } + } + } + } |
