From: Mischa POSLAWSKY Date: Sun, 9 Dec 2018 04:31:46 +0000 (+0100) Subject: login/edit: option to override tag labels X-Git-Tag: v3.9~20 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/943688a66694cc3d97188c7b789207aa3ee8bfc2 login/edit: option to override tag labels Sites can predefine elements of "values" with preferred label names instead of fallback to file names. --- diff --git a/login/edit.php b/login/edit.php index e60cf59..88272e0 100644 --- a/login/edit.php +++ b/login/edit.php @@ -41,8 +41,8 @@ foreach ($cols as $col => &$colconf) { $tagname = pathinfo($tag, PATHINFO_BASENAME); $target = "$tag/{$user['name']}"; $val = file_exists($target); - $tagopt = &$colconf['values'][$tagname]; - $tagopt = ['value' => $val]; + $tagopt = &$colconf['values'][$tagname] ?: []; + $tagopt['value'] = $val; if (!is_writable($tag)) { continue; # locked tag directory } @@ -201,9 +201,9 @@ foreach ($cols as $col => &$colconf) { '' . '', "tags[$tag]", "tag-$tag", - $val['value'] ? ' checked' : '', + !empty($val['value']) ? ' checked' : '', isset($val['target']) ? '' : ' readonly', - ucfirst($tag) + @$val['label'] ?: ucfirst($tag) ); } }