| 1 | <?php |
||
| 2 | |||
| 3 | namespace DNADesign\ElementalVirtual\Forms; |
||
| 4 | |||
| 5 | use SilverStripe\Forms\GridField\GridFieldDeleteAction; |
||
| 6 | use SilverStripe\Forms\GridField\GridField_FormAction; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @package elemental |
||
| 10 | */ |
||
| 11 | class ElementalGridFieldDeleteAction extends GridFieldDeleteAction |
||
| 12 | { |
||
| 13 | |||
| 14 | public function getColumnContent($gridField, $record, $columnName) |
||
| 15 | { |
||
| 16 | if (!$record->canDelete()) { |
||
| 17 | return; |
||
| 18 | } |
||
| 19 | |||
| 20 | if ($record->VirtualClones()->count() > 0) { |
||
| 21 | return false; |
||
|
0 ignored issues
–
show
|
|||
| 22 | } |
||
| 23 | |||
| 24 | return parent::getColumnContent($gridField, $record, $columnName); |
||
| 25 | } |
||
| 26 | } |
||
| 27 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: