Skip to content

Commit

Permalink
ENH Use SearchableMultiDropdownField
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 29, 2023
1 parent 805341b commit 74ba657
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions code/SiteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
use SilverStripe\Security\Security;
use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\Forms\SearchableMultiDropdownField;
use SilverStripe\Security\InheritedPermissions;
use SilverStripe\TagField\TagField;

/**
* SiteConfig
Expand Down Expand Up @@ -132,11 +134,13 @@ public function getCMSFields()
'data-placeholder',
_t('SilverStripe\\CMS\\Model\\SiteTree.GroupPlaceholder', 'Click to select group')
),
$viewerMembersField = ListboxField::create(
$viewerMembersField = SearchableMultiDropdownField::create(
"ViewerMembers",
_t(self::class . '.VIEWERMEMBERS', "Viewer Users"),
$membersMap,
),
Member::get()
)
->setIsLazyLoaded(true)
->setUseSearchContext(true),
$editorsOptionsField = OptionsetField::create(
"CanEditType",
_t(self::class . '.EDITHEADER', "Who can edit pages on this site?")
Expand All @@ -150,11 +154,13 @@ public function getCMSFields()
'data-placeholder',
_t('SilverStripe\\CMS\\Model\\SiteTree.GroupPlaceholder', 'Click to select group')
),
$editorMembersField = ListboxField::create(
$editorMembersField = SearchableMultiDropdownField::create(
"EditorMembers",
_t(self::class . '.EDITORMEMBERS', "Editor Users"),
$membersMap,
),
Member::get(),
)
->setIsLazyLoaded(true)
->setUseSearchContext(true),
$topLevelCreatorsOptionsField = OptionsetField::create(
"CanCreateTopLevelType",
_t(self::class . '.TOPLEVELCREATE', "Who can create pages in the root of the site?")
Expand All @@ -168,11 +174,13 @@ public function getCMSFields()
'data-placeholder',
_t('SilverStripe\\CMS\\Model\\SiteTree.GroupPlaceholder', 'Click to select group')
),
$topLevelCreatorsMembersField = ListboxField::create(
$topLevelCreatorsMembersField = SearchableMultiDropdownField::create(
"CreateTopLevelMembers",
_t(self::class . '.TOPLEVELCREATORUSERS', "Top level creator users"),
$membersMap,
Member::get()
)
->setIsLazyLoaded(true)
->setUseSearchContext(true)
)
),
HiddenField::create('ID')
Expand Down

0 comments on commit 74ba657

Please sign in to comment.