Skip to content

Commit

Permalink
fix: expose ShowInSearch field in access UI
Browse files Browse the repository at this point in the history
Upgrading from SilverStripe 3 to SilverStripe 5 it appears the ShowInSearch field is no longer displayed in the UI.

The File record still contains this data and the implementation was to match Page instances which contain the 'Show in search' option to CMS editors.
  • Loading branch information
wilr committed Sep 15, 2023
1 parent 4ab0da2 commit 1756577
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion code/Forms/AssetFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\FieldGroup;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
Expand Down Expand Up @@ -370,7 +371,7 @@ protected function getFormFieldSecurityTab($record, $context = [])
unset($editorsOptionsField[InheritedPermissions::ANYONE]);
$membersMap = Member::get()->map('ID', 'Name');

return Tab::create(
$tab = Tab::create(
'Permissions',
OptionsetField::create(
'CanViewType',
Expand Down Expand Up @@ -401,6 +402,17 @@ protected function getFormFieldSecurityTab($record, $context = [])
$membersMap
)
);

if ($record instanceof File) {
$tab->push(
CheckboxField::create(
'ShowInSearch',
_t(__CLASS__.'.SHOWINSEARRCH', 'Show in search?')
)
);
}

return $tab;
}

public function getRequiredContext()
Expand Down

0 comments on commit 1756577

Please sign in to comment.