Merge pull request #5013 from Legin76/patch-2

This commit is contained in:
Daniel Hensby 2016-02-04 21:23:47 +00:00
commit 31a4e184f7

View File

@ -1498,6 +1498,14 @@ class UploadField_SelectHandler extends RequestHandler {
*/ */
protected $folderName; protected $folderName;
/**
* Set pagination quantity for file list field
*
* @config
* @var int
*/
private static $page_size = 11;
private static $url_handlers = array( private static $url_handlers = array(
'$Action!' => '$Action', '$Action!' => '$Action',
'' => 'index', '' => 'index',
@ -1580,7 +1588,10 @@ class UploadField_SelectHandler extends RequestHandler {
$colsComponent->setFieldCasting(array( $colsComponent->setFieldCasting(array(
'Created' => 'SS_Datetime->Nice' 'Created' => 'SS_Datetime->Nice'
)); ));
$config->addComponent(new GridFieldPaginator(11));
// Set configurable pagination for file list field
$pageSize = Config::inst()->get(get_class($this), 'page_size');
$config->addComponent(new GridFieldPaginator($pageSize));
// If relation is to be autoset, we need to make sure we only list compatible objects. // If relation is to be autoset, we need to make sure we only list compatible objects.
$baseClass = $this->parent->getRelationAutosetClass(); $baseClass = $this->parent->getRelationAutosetClass();