Merge pull request #7750 from creative-commoners/pulls/4.1/remove-relation-setters

NEW Add getter and setter for removeRelation in GridFieldDeleteAction
This commit is contained in:
Loz Calver 2018-01-12 09:58:23 +00:00 committed by GitHub
commit 67ea95bc2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
*/ */
public function __construct($removeRelation = false) 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) public function getColumnContent($gridField, $record, $columnName)
{ {
if ($this->removeRelation) { if ($this->getRemoveRelation()) {
if (!$record->canEdit()) { if (!$record->canEdit()) {
return null; 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;
}
} }