From c56fad7944a67eb3e9940cabf450ed20a15bf0d7 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 28 Nov 2023 14:28:44 +1300 Subject: [PATCH] ENH Use SearchableMutliDropdownField to select Members --- code/Model/SiteTree.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 42b516a931..d97d2bb77f 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -38,6 +38,7 @@ use SilverStripe\Forms\ListboxField; use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\OptionsetField; +use SilverStripe\Forms\SearchableMultiDropdownField; use SilverStripe\Forms\Tab; use SilverStripe\Forms\TabSet; use SilverStripe\Forms\TextareaField; @@ -2296,11 +2297,13 @@ public function getSettingsFields() _t(__CLASS__.'.VIEWERGROUPS', "Viewer Groups"), Group::class ), - $viewerMembersField = ListboxField::create( + $viewerMembersField = SearchableMultiDropdownField::create( "ViewerMembers", _t(__CLASS__.'.VIEWERMEMBERS', "Viewer Users"), - $membersMap, - ), + Member::get(), + ) + ->setIsLazyLoaded(true) + ->setUseSearchContext(true), $editorsOptionsField = new OptionsetField( "CanEditType", _t(__CLASS__.'.EDITHEADER', "Who can edit this page?") @@ -2310,11 +2313,13 @@ public function getSettingsFields() _t(__CLASS__.'.EDITORGROUPS', "Editor Groups"), Group::class ), - $editorMembersField = ListboxField::create( + $editorMembersField = SearchableMultiDropdownField::create( "EditorMembers", _t(__CLASS__.'.EDITORMEMBERS', "Editor Users"), - $membersMap + Member::get() ) + ->setIsLazyLoaded(true) + ->setUseSearchContext(true) ) ) );