mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
DOCS Update PSR-12 compliance in GridField_ActionProvider docs code examples
[ci skip]
This commit is contained in:
parent
ed47f43133
commit
b8e81983b9
@ -51,7 +51,7 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function getColumnMetadata($gridField, $columnName)
|
public function getColumnMetadata($gridField, $columnName)
|
||||||
{
|
{
|
||||||
if($columnName == 'Actions') {
|
if ($columnName === 'Actions') {
|
||||||
return ['title' => ''];
|
return ['title' => ''];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +63,9 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function getColumnContent($gridField, $record, $columnName)
|
public function getColumnContent($gridField, $record, $columnName)
|
||||||
{
|
{
|
||||||
if(!$record->canEdit()) return;
|
if (!$record->canEdit()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$field = GridField_FormAction::create(
|
$field = GridField_FormAction::create(
|
||||||
$gridField,
|
$gridField,
|
||||||
@ -83,7 +85,9 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
|
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
|
||||||
{
|
{
|
||||||
if($actionName == 'docustomaction') {
|
if ($actionName !== 'docustomaction') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// perform your action here
|
// perform your action here
|
||||||
|
|
||||||
// output a success message to the user
|
// output a success message to the user
|
||||||
@ -93,7 +97,6 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Add the GridFieldCustomAction to the current `GridFieldConfig`
|
## Add the GridFieldCustomAction to the current `GridFieldConfig`
|
||||||
@ -186,7 +189,9 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function getCustomAction($gridField, $record)
|
public function getCustomAction($gridField, $record)
|
||||||
{
|
{
|
||||||
if(!$record->canEdit()) return;
|
if (!$record->canEdit()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return GridField_FormAction::create(
|
return GridField_FormAction::create(
|
||||||
$gridField,
|
$gridField,
|
||||||
@ -227,7 +232,7 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function getColumnMetadata($gridField, $columnName)
|
public function getColumnMetadata($gridField, $columnName)
|
||||||
{
|
{
|
||||||
if($columnName == 'Actions') {
|
if ($columnName === 'Actions') {
|
||||||
return ['title' => ''];
|
return ['title' => ''];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +260,9 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
|
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
|
||||||
{
|
{
|
||||||
if($actionName == 'docustomaction') {
|
if ($actionName !== 'docustomaction') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// perform your action here
|
// perform your action here
|
||||||
|
|
||||||
// output a success message to the user
|
// output a success message to the user
|
||||||
@ -265,7 +272,6 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Related
|
## Related
|
||||||
|
Loading…
Reference in New Issue
Block a user