mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
commit
67ea95bc2a
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user