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
@ -39,7 +39,7 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function augmentColumns($gridField, &$columns)
|
public function augmentColumns($gridField, &$columns)
|
||||||
{
|
{
|
||||||
if(!in_array('Actions', $columns)) {
|
if (!in_array('Actions', $columns)) {
|
||||||
$columns[] = 'Actions';
|
$columns[] = 'Actions';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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
|
||||||
@ -92,7 +96,6 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
'Do Custom Action Done.'
|
'Do Custom Action Done.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -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,
|
||||||
@ -215,7 +220,7 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
|
|
||||||
public function augmentColumns($gridField, &$columns)
|
public function augmentColumns($gridField, &$columns)
|
||||||
{
|
{
|
||||||
if(!in_array('Actions', $columns)) {
|
if (!in_array('Actions', $columns)) {
|
||||||
$columns[] = 'Actions';
|
$columns[] = 'Actions';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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
|
||||||
@ -264,7 +271,6 @@ class GridFieldCustomAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
'Do Custom Action Done.'
|
'Do Custom Action Done.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user