| Conditions | 1 |
| Paths | 1 |
| Total Lines | 50 |
| Code Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 6 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | public function __construct($itemsPerPage = 25) |
||
| 6 | { |
||
| 7 | parent::__construct($itemsPerPage); |
||
| 8 | |||
| 9 | // $this->addComponent(new GridFieldExportButton()); |
||
| 10 | |||
| 11 | $this->addComponent(new CommentsGridFieldAction()); |
||
| 12 | |||
| 13 | // Format column |
||
| 14 | $columns = $this->getComponentByType('GridFieldDataColumns'); |
||
| 15 | $columns->setFieldFormatting(array( |
||
| 16 | 'ParentTitle' => function ($value, &$item) { |
||
| 17 | return sprintf( |
||
| 18 | '<a href="%s" class="cms-panel-link external-link action" target="_blank">%s</a>', |
||
| 19 | Convert::raw2att($item->Link()), |
||
| 20 | $item->obj('ParentTitle')->forTemplate() |
||
| 21 | ); |
||
| 22 | } |
||
| 23 | )); |
||
| 24 | |||
| 25 | // Add bulk option |
||
| 26 | $manager = new GridFieldBulkManager(); |
||
| 27 | |||
| 28 | $manager->addBulkAction( |
||
| 29 | 'spam', |
||
| 30 | _t('CommentsGridFieldConfig.SPAM', 'Spam'), |
||
| 31 | 'CommentsGridFieldBulkAction_Handlers', |
||
| 32 | array( |
||
| 33 | 'isAjax' => true, |
||
| 34 | 'icon' => 'cross', |
||
| 35 | 'isDestructive' => false |
||
| 36 | ) |
||
| 37 | ); |
||
| 38 | |||
| 39 | $manager->addBulkAction( |
||
| 40 | 'approve', |
||
| 41 | _t('CommentsGridFieldConfig.APPROVE', 'Approve'), |
||
| 42 | 'CommentsGridFieldBulkAction_Handlers', |
||
| 43 | array( |
||
| 44 | 'isAjax' => true, |
||
| 45 | 'icon' => 'cross', |
||
| 46 | 'isDestructive' => false |
||
| 47 | ) |
||
| 48 | ); |
||
| 49 | |||
| 50 | $manager->removeBulkAction('bulkEdit'); |
||
| 51 | $manager->removeBulkAction('unLink'); |
||
| 52 | |||
| 53 | $this->addComponent($manager); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.