Update docs for GridField_ActionMenuItem required parameters

I found these errors while going through this tutorial,
missing ```use use SilverStripe\Forms\GridField\GridField;```

interface GridField_ActionMenuItem required parameters on  getTitle() and getGroup()

incorrect if statement on getExtraData() - $field is not defined
This commit is contained in:
Vinnie 2019-05-09 09:01:54 +12:00 committed by GitHub
parent 2bdf1eac0a
commit 168a4fe489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ below:
use SilverStripe\Forms\GridField\GridField_ColumnProvider; use SilverStripe\Forms\GridField\GridField_ColumnProvider;
use SilverStripe\Forms\GridField\GridField_ActionProvider; use SilverStripe\Forms\GridField\GridField_ActionProvider;
use SilverStripe\Forms\GridField\GridField_FormAction; use SilverStripe\Forms\GridField\GridField_FormAction;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
class GridFieldCustomAction implements GridField_ColumnProvider, GridField_ActionProvider class GridFieldCustomAction implements GridField_ColumnProvider, GridField_ActionProvider
@ -176,20 +177,20 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
} }
} }
public function getTitle($gridField, $record) public function getTitle($gridField, $record, $columnName)
{ {
return _t(__CLASS__ . '.Delete', "Delete"); return _t(__CLASS__ . '.Delete', "Delete");
} }
public function getGroup($gridField, $record) public function getGroup($gridField, $record, $columnName)
{ {
return GridField_ActionMenuItem::DEFAULT_GROUP; return GridField_ActionMenuItem::DEFAULT_GROUP;
} }
public function getExtraData($gridField, $record, $columnName) public function getExtraData($gridField, $record, $columnName)
{ {
if ($field) { if ($gridField) {
return $field->getAttributes(); return $gridField->getAttributes();
} }
return null; return null;