mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: Don't force-add view button to readonly GridField (fixes #9249)
This commit is contained in:
parent
109ac3f75f
commit
d85ff3bc44
@ -247,6 +247,7 @@ class GridField extends FormField
|
||||
$copy = clone $this;
|
||||
$copy->setReadonly(true);
|
||||
$copyConfig = $copy->getConfig();
|
||||
$hadEditButton = $copyConfig->getComponentByType(GridFieldEditButton::class) !== null;
|
||||
|
||||
// get the whitelist for allowable readonly components
|
||||
$allowedComponents = $this->getReadonlyComponents();
|
||||
@ -257,8 +258,8 @@ class GridField extends FormField
|
||||
}
|
||||
}
|
||||
|
||||
// As the edit button may have been removed, add a view button if it doesn't have one
|
||||
if (!$copyConfig->getComponentByType(GridFieldViewButton::class)) {
|
||||
// If the edit button has been removed, replace it with a view button
|
||||
if ($hadEditButton && !$copyConfig->getComponentByType(GridFieldViewButton::class)) {
|
||||
$copyConfig->addComponent(new GridFieldViewButton);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user