Use dynamic field values

This commit is contained in:
Giuseppe Criscione 2022-12-11 18:07:36 +01:00
parent 937954b01c
commit 10cfd66fad
3 changed files with 8 additions and 15 deletions

View File

@ -35,7 +35,7 @@ class UserCollection extends AbstractCollection
/**
* Get all available roles
*/
public static function availableRoles(): array
public function availableRoles(): array
{
$roles = [];
foreach (static::$roles as $role => $data) {

View File

@ -32,15 +32,13 @@ fields:
label: '{{panel.user.language}}'
required: true
translate: [label]
import:
options: 'Formwork\Panel\Panel::availableTranslations'
options@: formwork.panel().availableTranslations()
role:
type: select
label: '{{panel.user.role}}'
disabled: true
import:
options: 'Formwork\Panel\Users\UserCollection::availableRoles'
options@: formwork.panel().users().availableRoles()
colorScheme:

View File

@ -42,20 +42,17 @@ fields:
date.format:
type: select
label: '{{panel.options.system.dateAndTime.dateFormat}}'
import:
options: 'Formwork\Panel\Utils\DateFormats::date'
options@: dateFormats.date
date.timeFormat:
type: select
label: '{{panel.options.system.dateAndTime.hourFormat}}'
import:
options: 'Formwork\Panel\Utils\DateFormats::hour'
options@: dateFormats.hour
date.timezone:
type: select
label: '{{panel.options.system.dateAndTime.timezone}}'
import:
options: 'Formwork\Panel\Utils\DateFormats::timezones'
options@: dateFormats.timezones
date.weekStarts:
type: select
@ -70,8 +67,7 @@ fields:
placeholder: '{{panel.options.system.languages.availableLanguages.noLanguages}}'
pattern: '^[a-z]{2,3}$'
translate: [label, placeholder]
import:
options: 'Formwork\Languages\LanguageCodes::names'
options@: languages.names
languages.httpPreferred:
type: togglegroup
@ -106,8 +102,7 @@ fields:
type: select
label: '{{panel.options.system.adminPanel.defaultLanguage}}'
translate: [label]
import:
options: 'Formwork\Panel\Panel::availableTranslations'
options@: formwork.panel().availableTranslations()
panel.logoutRedirect:
type: togglegroup