Commit 8af3f248 authored by Tino Goratsch's avatar Tino Goratsch

simplified the usage and creation of the column renderers

parent 76358dd4
......@@ -4,6 +4,7 @@ namespace ACP3\Core\Helpers;
use ACP3\Core\ACL;
use ACP3\Core\Helpers\DataGrid\ColumnPriorityQueue;
use ACP3\Core\Helpers\DataGrid\ColumnRenderer\ColumnRendererInterface;
use ACP3\Core\Helpers\DataGrid\ColumnRenderer\HeaderColumnRenderer;
use ACP3\Core\Helpers\DataGrid\ColumnRenderer\MassActionColumnRenderer;
use ACP3\Core\Helpers\DataGrid\ColumnRenderer\OptionColumnRenderer;
use ACP3\Core\I18n\Translator;
......@@ -84,7 +85,7 @@ class DataGrid
*/
public function registerColumnRenderer(ColumnRendererInterface $columnRenderer)
{
$this->columnRenderer[$columnRenderer->getName()] = $columnRenderer;
$this->columnRenderer[get_class($columnRenderer)] = $columnRenderer;
return $this;
}
......@@ -233,7 +234,7 @@ class DataGrid
foreach (clone $this->columns as $column) {
if (!empty($column['label'])) {
$header .= $this->columnRenderer['table_header']
$header .= $this->columnRenderer[HeaderColumnRenderer::class]
->setIdentifier($this->identifier)
->setPrimaryKey($this->primaryKey)
->fetchDataAndRenderColumn($column, []);
......@@ -311,7 +312,7 @@ class DataGrid
if ($this->enableMassAction && $canDelete) {
$this->addColumn([
'label' => $this->identifier,
'type' => MassActionColumnRenderer::NAME,
'type' => MassActionColumnRenderer::class,
'class' => 'datagrid-column datagrid-column__mass-action',
'sortable' => false,
'custom' => [
......@@ -323,7 +324,7 @@ class DataGrid
if ($this->enableOptions) {
$this->addColumn([
'label' => $this->translator->t('system', 'action'),
'type' => OptionColumnRenderer::NAME,
'type' => OptionColumnRenderer::class,
'class' => 'datagrid-column datagrid-column__actions',
'sortable' => false,
'custom' => [
......
......@@ -8,7 +8,6 @@ namespace ACP3\Core\Helpers\DataGrid\ColumnRenderer;
abstract class AbstractColumnRenderer implements ColumnRendererInterface
{
const CELL_TYPE = 'td';
const NAME = '';
/**
* @var string
......@@ -19,14 +18,6 @@ abstract class AbstractColumnRenderer implements ColumnRendererInterface
*/
protected $primaryKey = '';
/**
* @return string
*/
public function getName()
{
return static::NAME;
}
/**
* @param string $identifier
*
......
......@@ -14,9 +14,4 @@ interface ColumnRendererInterface
* @return string
*/
public function fetchDataAndRenderColumn(array $column, array $dbResultRow);
/**
* @return string
*/
public function getName();
}
\ No newline at end of file
......@@ -10,7 +10,6 @@ use ACP3\Core\Helpers\Formatter\DateRange;
*/
class DateColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'date';
/**
* @var \ACP3\Core\Date
*/
......
......@@ -8,7 +8,6 @@ use ACP3\Core\Helpers\Formatter\MarkEntries;
*/
class HeaderColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'table_header';
const CELL_TYPE = 'th';
/**
......@@ -31,7 +30,7 @@ class HeaderColumnRenderer extends AbstractColumnRenderer
*/
public function fetchDataAndRenderColumn(array $column, array $dbResultRow)
{
if ($column['type'] === 'mass_action') {
if ($column['type'] === MassActionColumnRenderer::class) {
$id = preg_replace('=[^\w\d-_]=', '', $column['label']) . '-mark-all';
$value = '<input type="checkbox" id="' . $id . '" value="1" ' . $this->markEntriesHelper->execute('entries', $id) . '>';
} else {
......
......@@ -7,8 +7,6 @@ namespace ACP3\Core\Helpers\DataGrid\ColumnRenderer;
*/
class IntegerColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'integer';
/**
* @param array $dbResultRow
* @param string $field
......
......@@ -7,8 +7,6 @@ namespace ACP3\Core\Helpers\DataGrid\ColumnRenderer;
*/
class MassActionColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'mass_action';
/**
* @inheritdoc
*/
......
......@@ -8,8 +8,6 @@ use ACP3\Core\Helpers\StringFormatter;
*/
class Nl2pColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'nl2p';
/**
* @var \ACP3\Core\Helpers\StringFormatter
*/
......
......@@ -13,8 +13,6 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
*/
class OptionColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'options';
/**
* @var \ACP3\Core\I18n\Translator
*/
......
......@@ -9,8 +9,6 @@ use ACP3\Core\Router;
*/
class PictureColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'picture';
/**
* @var \ACP3\Core\Router
*/
......
......@@ -7,8 +7,6 @@ namespace ACP3\Core\Helpers\DataGrid\ColumnRenderer;
*/
class ReplaceValueColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'replace_value';
/**
* @var array
*/
......
......@@ -7,5 +7,4 @@ namespace ACP3\Core\Helpers\DataGrid\ColumnRenderer;
*/
class TextColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'text';
}
\ No newline at end of file
......@@ -9,8 +9,6 @@ use ACP3\Core\I18n\Translator;
*/
class TranslateColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'translate';
/**
* @var
*/
......
......@@ -329,18 +329,18 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'publication_period'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['start', 'end']
], 30)
->addColumn([
'label' => $this->translator->t('articles', 'title'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['title'],
'default_sort' => true
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -254,23 +254,23 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('categories', 'title'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['title'],
'default_sort' => true
], 30)
->addColumn([
'label' => $this->translator->t('system', 'description'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['description']
], 20)
->addColumn([
'label' => $this->translator->t('categories', 'module'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TranslateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TranslateColumnRenderer::class,
'fields' => ['module'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -174,28 +174,28 @@ class Details extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'date'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['date'],
'default_sort' => true
], 50)
->addColumn([
'label' => $this->translator->t('system', 'name'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['name'],
], 40)
->addColumn([
'label' => $this->translator->t('system', 'message'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\Nl2pColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\Nl2pColumnRenderer::class,
'fields' => ['message'],
], 30)
->addColumn([
'label' => $this->translator->t('comments', 'ip'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['ip'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -93,13 +93,13 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('comments', 'module'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TranslateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TranslateColumnRenderer::class,
'fields' => ['module'],
'default_sort' => true
], 30)
->addColumn([
'label' => $this->translator->t('comments', 'comments_count'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['comments_count'],
], 20)
->addColumn([
......
......@@ -220,17 +220,17 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'description'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['description'],
], 40)
->addColumn([
'label' => $this->translator->t('emoticons', 'code'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['code']
], 30)
->addColumn([
'label' => $this->translator->t('emoticons', 'picture'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\PictureColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\PictureColumnRenderer::class,
'fields' => ['img'],
'custom' => [
'pattern' => $this->appPath->getWebRoot() . 'uploads/emoticons/%s'
......@@ -238,7 +238,7 @@ class Index extends Core\Modules\AdminController
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true,
'default_sort' => true
......
......@@ -230,23 +230,23 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'publication_period'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['start', 'end'],
'default_sort' => true
], 50)
->addColumn([
'label' => $this->translator->t('files', 'title'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['title'],
], 40)
->addColumn([
'label' => $this->translator->t('system', 'description'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['description'],
], 30)
->addColumn([
'label' => $this->translator->t('files', 'filesize'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['size'],
'customer' => [
'default_value' => $this->translator->t('files', 'unknown_filesize')
......@@ -254,7 +254,7 @@ class Index extends Core\Modules\AdminController
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -190,7 +190,7 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('gallery', 'picture'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\PictureColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\PictureColumnRenderer::class,
'fields' => ['id'],
'custom' => [
'pattern' => 'gallery/index/image/id_%s/action_thumb',
......@@ -199,18 +199,18 @@ class Index extends Core\Modules\AdminController
], 30)
->addColumn([
'label' => $this->translator->t('system', 'description'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['description'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'order'),
'type' => Gallery\Helper\DataGrid\ColumnRenderer\PictureSortColumnRenderer::NAME,
'type' => Gallery\Helper\DataGrid\ColumnRenderer\PictureSortColumnRenderer::class,
'fields' => ['pic'],
'default_sort' => true
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......@@ -240,23 +240,23 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'publication_period'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['start', 'end'],
'default_sort' => true
], 30)
->addColumn([
'label' => $this->translator->t('gallery', 'title'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['title'],
], 20)
->addColumn([
'label' => $this->translator->t('gallery', 'pictures'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['pictures'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -12,8 +12,6 @@ use ACP3\Core\Router;
*/
class PictureSortColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'picture_sort';
/**
* @var \ACP3\Core\I18n\Translator
*/
......
......@@ -155,28 +155,28 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'date'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['date'],
'default_sort' => true
], 50)
->addColumn([
'label' => $this->translator->t('system', 'name'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['name'],
], 40)
->addColumn([
'label' => $this->translator->t('system', 'message'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\Nl2pColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\Nl2pColumnRenderer::class,
'fields' => ['message'],
], 30)
->addColumn([
'label' => $this->translator->t('guestbook', 'ip'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['ip'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -201,23 +201,23 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'publication_period'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['start', 'end'],
'default_sort' => true
], 30)
->addColumn([
'label' => $this->translator->t('news', 'title'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['title'],
], 20)
->addColumn([
'label' => $this->translator->t('categories', 'category'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['cat']
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -95,13 +95,13 @@ class Accounts extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'email_address'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['mail'],
'default_sort' => true
], 60)
->addColumn([
'label' => $this->translator->t('newsletter', 'salutation'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\ReplaceValueColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\ReplaceValueColumnRenderer::class,
'fields' => ['salutation'],
'custom' => [
'search' => [0, 1, 2],
......@@ -114,22 +114,22 @@ class Accounts extends Core\Modules\AdminController
], 50)
->addColumn([
'label' => $this->translator->t('newsletter', 'first_name'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['first_name'],
], 40)
->addColumn([
'label' => $this->translator->t('newsletter', 'last_name'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['last_name'],
], 30)
->addColumn([
'label' => $this->translator->t('newsletter', 'status'),
'type' => Newsletter\Helper\DataGrid\ColumnRenderer\AccountStatusColumnRenderer::NAME,
'type' => Newsletter\Helper\DataGrid\ColumnRenderer\AccountStatusColumnRenderer::class,
'fields' => ['status'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -175,18 +175,18 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'date'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['date'],
'default_sort' => true
], 50)
->addColumn([
'label' => $this->translator->t('newsletter', 'subject'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['title'],
], 40)
->addColumn([
'label' => $this->translator->t('newsletter', 'status'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\ReplaceValueColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\ReplaceValueColumnRenderer::class,
'fields' => ['status'],
'custom' => [
'search' => [0, 1],
......@@ -198,7 +198,7 @@ class Index extends Core\Modules\AdminController
], 30)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -11,8 +11,6 @@ use ACP3\Core\Router;
*/
class AccountStatusColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'account_status';
/**
* @var \ACP3\Core\I18n\Translator
*/
......
......@@ -186,18 +186,18 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'publication_period'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\DateColumnRenderer::class,
'fields' => ['start', 'end'],
'default_sort' => true
], 30)
->addColumn([
'label' => $this->translator->t('polls', 'question'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['title'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -146,28 +146,28 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('seo', 'uri'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['uri'],
'default_sort' => true
], 60)
->addColumn([
'label' => $this->translator->t('seo', 'alias'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['alias'],
], 50)
->addColumn([
'label' => $this->translator->t('seo', 'keywords'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['keywords'],
], 40)
->addColumn([
'label' => $this->translator->t('seo', 'description'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['description'],
], 30)
->addColumn([
'label' => $this->translator->t('seo', 'robots'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\ReplaceValueColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\ReplaceValueColumnRenderer::class,
'fields' => ['robots'],
'custom' => [
'search' => [0, 1, 2, 3, 4],
......@@ -183,7 +183,7 @@ class Index extends Core\Modules\AdminController
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -255,23 +255,23 @@ class Index extends Core\Modules\AdminController
$dataGrid
->addColumn([
'label' => $this->translator->t('users', 'nickname'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['nickname'],
'default_sort' => true
], 40)
->addColumn([
'label' => $this->translator->t('system', 'email_address'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['mail'],
], 30)
->addColumn([
'label' => $this->translator->t('permissions', 'roles'),
'type' => Users\Helpers\DataGrid\ColumnRenderer\UserRolesColumnRenderer::NAME,
'type' => Users\Helpers\DataGrid\ColumnRenderer\UserRolesColumnRenderer::class,
'fields' => ['id'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::NAME,
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
......
......@@ -11,8 +11,6 @@ use ACP3\Core\Helpers\DataGrid\ColumnRenderer\AbstractColumnRenderer;
*/
class UserRolesColumnRenderer extends AbstractColumnRenderer
{
const NAME = 'user_roles';
/**
* @var \ACP3\Core\ACL
*/
......
......@@ -151,15 +151,6 @@ abstract class AbstractColumnRendererTest extends PHPUnit_Framework_TestCase
$this->compareResults($expected);
}
public function testGetType()
{
$this->assertNotEmpty($this->columnRenderer->getName());
/** @var \ACP3\Core\Helpers\DataGrid\ColumnRenderer\AbstractColumnRenderer $className */