mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-21 00:46:07 +02:00
5c54276b6f
* ENH Make all GridField components injectable. Some components were already injectable, but all GridField components shipped in silverstripe should be injectable. This makes it a LOT easier to make global project-specific changes to a given component. The new AbstractGridFieldComponent also makes it easy to make similar wide-spread changes in the future. * DOCS Encourage injection for GridField and GridFieldComponents.
33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Forms\GridField;
|
|
|
|
/**
|
|
* A simple readonly, paginated view of records, with sortable and searchable
|
|
* headers.
|
|
*/
|
|
class GridFieldConfig_Base extends GridFieldConfig
|
|
{
|
|
|
|
/**
|
|
* @param int $itemsPerPage - How many items per page should show up
|
|
*/
|
|
public function __construct($itemsPerPage = null)
|
|
{
|
|
parent::__construct();
|
|
$this->addComponent(GridFieldToolbarHeader::create());
|
|
$this->addComponent(GridFieldButtonRow::create('before'));
|
|
$this->addComponent($sort = GridFieldSortableHeader::create());
|
|
$this->addComponent($filter = GridFieldFilterHeader::create());
|
|
$this->addComponent(GridFieldDataColumns::create());
|
|
$this->addComponent(GridFieldPageCount::create('toolbar-header-right'));
|
|
$this->addComponent($pagination = GridFieldPaginator::create($itemsPerPage));
|
|
|
|
$sort->setThrowExceptionOnBadDataType(false);
|
|
$filter->setThrowExceptionOnBadDataType(false);
|
|
$pagination->setThrowExceptionOnBadDataType(false);
|
|
|
|
$this->extend('updateConfig');
|
|
}
|
|
}
|