mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
NEW Add getter and setter for removeRelation in GridFieldDeleteAction
This allows users to modify the property value in the component without having to remove it and add a new one when they want to change it.
This commit is contained in:
parent
844a4c96e4
commit
9fddb5de99
@ -41,7 +41,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
|
||||
*/
|
||||
public function __construct($removeRelation = false)
|
||||
{
|
||||
$this->removeRelation = $removeRelation;
|
||||
$this->setRemoveRelation($removeRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +115,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
|
||||
*/
|
||||
public function getColumnContent($gridField, $record, $columnName)
|
||||
{
|
||||
if ($this->removeRelation) {
|
||||
if ($this->getRemoveRelation()) {
|
||||
if (!$record->canEdit()) {
|
||||
return null;
|
||||
}
|
||||
@ -187,4 +187,25 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether to remove or delete the relation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getRemoveRelation()
|
||||
{
|
||||
return $this->removeRelation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to remove or delete the relation
|
||||
* @param bool $removeRelation
|
||||
* @return $this
|
||||
*/
|
||||
public function setRemoveRelation($removeRelation)
|
||||
{
|
||||
$this->removeRelation = (bool) $removeRelation;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user