2015-04-07 05:56:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor {
|
|
|
|
public function __construct($itemsPerPage = 25) {
|
|
|
|
parent::__construct($itemsPerPage);
|
|
|
|
|
2015-04-13 05:41:18 +02:00
|
|
|
// $this->addComponent(new GridFieldExportButton());
|
|
|
|
|
|
|
|
$this->addComponent(new CommentsGridFieldAction());
|
2015-04-07 05:56:00 +02:00
|
|
|
|
|
|
|
// 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::raw2xml($item->Link()),
|
|
|
|
Convert::raw2xml($value)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
|
|
|
|
// Add bulk option
|
|
|
|
$manager = new GridFieldBulkManager();
|
2015-04-13 05:41:18 +02:00
|
|
|
|
|
|
|
$manager->addBulkAction(
|
2015-04-16 04:40:16 +02:00
|
|
|
'spam', 'Spam', 'CommentsGridFieldBulkAction_Handlers',
|
2015-04-13 05:41:18 +02:00
|
|
|
array(
|
|
|
|
'isAjax' => true,
|
|
|
|
'icon' => 'cross',
|
|
|
|
'isDestructive' => false
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2015-04-07 05:56:00 +02:00
|
|
|
$manager->addBulkAction(
|
2015-04-16 04:40:16 +02:00
|
|
|
'approve', 'Approve', 'CommentsGridFieldBulkAction_Handlers',
|
2015-04-07 05:56:00 +02:00
|
|
|
array(
|
|
|
|
'isAjax' => true,
|
2015-04-13 05:41:18 +02:00
|
|
|
'icon' => 'cross',
|
|
|
|
'isDestructive' => false
|
2015-04-07 05:56:00 +02:00
|
|
|
)
|
|
|
|
);
|
2015-04-13 05:41:18 +02:00
|
|
|
|
|
|
|
$manager->removeBulkAction('bulkEdit');
|
|
|
|
$manager->removeBulkAction('unLink');
|
|
|
|
|
2015-04-07 05:56:00 +02:00
|
|
|
$this->addComponent($manager);
|
|
|
|
}
|
|
|
|
}
|