2015-04-07 05:56:00 +02:00
|
|
|
<?php
|
|
|
|
|
2016-02-19 01:48:25 +01:00
|
|
|
class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor
|
|
|
|
{
|
|
|
|
public function __construct($itemsPerPage = 25)
|
|
|
|
{
|
|
|
|
parent::__construct($itemsPerPage);
|
|
|
|
|
|
|
|
// $this->addComponent(new GridFieldExportButton());
|
|
|
|
|
|
|
|
$this->addComponent(new CommentsGridFieldAction());
|
|
|
|
|
|
|
|
// Format column
|
|
|
|
$columns = $this->getComponentByType('GridFieldDataColumns');
|
|
|
|
$columns->setFieldFormatting(array(
|
|
|
|
'ParentTitle' => function ($value, &$item) {
|
|
|
|
return sprintf(
|
|
|
|
'<a href="%s" class="cms-panel-link external-link action" target="_blank">%s</a>',
|
|
|
|
Convert::raw2att($item->Link()),
|
|
|
|
$item->obj('ParentTitle')->forTemplate()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
|
|
|
|
// Add bulk option
|
|
|
|
$manager = new GridFieldBulkManager();
|
|
|
|
|
|
|
|
$manager->addBulkAction(
|
2016-06-10 15:08:45 +02:00
|
|
|
'spam',
|
|
|
|
_t('CommentsGridFieldConfig.SPAM', 'Spam'),
|
|
|
|
'CommentsGridFieldBulkAction_Handlers',
|
2016-02-19 01:48:25 +01:00
|
|
|
array(
|
|
|
|
'isAjax' => true,
|
|
|
|
'icon' => 'cross',
|
|
|
|
'isDestructive' => false
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$manager->addBulkAction(
|
2016-06-10 15:08:45 +02:00
|
|
|
'approve',
|
|
|
|
_t('CommentsGridFieldConfig.APPROVE', 'Approve'),
|
|
|
|
'CommentsGridFieldBulkAction_Handlers',
|
2016-02-19 01:48:25 +01:00
|
|
|
array(
|
|
|
|
'isAjax' => true,
|
|
|
|
'icon' => 'cross',
|
|
|
|
'isDestructive' => false
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$manager->removeBulkAction('bulkEdit');
|
|
|
|
$manager->removeBulkAction('unLink');
|
|
|
|
|
|
|
|
$this->addComponent($manager);
|
|
|
|
}
|
|
|
|
}
|