From 68433cc5521a09e4877a5e5115878567471ba088 Mon Sep 17 00:00:00 2001 From: Legin76 Date: Thu, 4 Feb 2016 17:23:32 +0000 Subject: [PATCH] Update UploadField.php to allow configurable GridFieldPaginator Changed $config->addComponent(new GridFieldPaginator(11)); to allow it to be configured from the config.yml --- forms/UploadField.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/forms/UploadField.php b/forms/UploadField.php index 917d77b63..046f676dd 100644 --- a/forms/UploadField.php +++ b/forms/UploadField.php @@ -1498,6 +1498,9 @@ class UploadField_SelectHandler extends RequestHandler { */ protected $folderName; + // Set pagnation quantity for file list field + private static $page_size = 11; + private static $url_handlers = array( '$Action!' => '$Action', '' => 'index', @@ -1580,7 +1583,10 @@ class UploadField_SelectHandler extends RequestHandler { $colsComponent->setFieldCasting(array( '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. $baseClass = $this->parent->getRelationAutosetClass();