2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms\Tests\GridField\GridFieldTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\Forms\GridField\GridField;
|
|
|
|
use SilverStripe\Forms\GridField\GridField_ActionProvider;
|
|
|
|
use SilverStripe\Forms\GridField\GridField_ColumnProvider;
|
|
|
|
|
|
|
|
class Component implements GridField_ColumnProvider, GridField_ActionProvider, TestOnly
|
|
|
|
{
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function augmentColumns($gridField, &$columns)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getColumnContent($gridField, $record, $columnName)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getColumnAttributes($gridField, $record, $columnName)
|
|
|
|
{
|
|
|
|
if ($columnName == 'Surname') {
|
|
|
|
return 'shouldnotbestring';
|
|
|
|
}
|
2020-04-20 19:58:09 +02:00
|
|
|
return ['class' => 'css-class'];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getColumnMetadata($gridField, $columnName)
|
|
|
|
{
|
|
|
|
if ($columnName == 'Surname') {
|
|
|
|
return 'shouldnotbestring';
|
|
|
|
} elseif ($columnName == 'FirstName') {
|
2020-04-20 19:58:09 +02:00
|
|
|
return [];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
2020-04-20 19:58:09 +02:00
|
|
|
return ['metadata' => 'istrue'];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param GridField $gridField
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getColumnsHandled($gridField)
|
|
|
|
{
|
2020-04-20 19:58:09 +02:00
|
|
|
return ['Email', 'Surname', 'FirstName'];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getActions($gridField)
|
|
|
|
{
|
2020-04-20 19:58:09 +02:00
|
|
|
return ['jump'];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
|
|
|
|
{
|
|
|
|
return 'handledAction is executed';
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|