Skip to content

Commit

Permalink
Paginate Image thumbnail view to 24 images (6 rows of 4) per page (Ku…
Browse files Browse the repository at this point in the history
…nstmaan#1633)

[MediaBundle] Paginate Image thumbnail view to 24 images (6 rows of 4) per page
  • Loading branch information
delboy1978uk authored and dbeerten committed Dec 7, 2017
1 parent b886e9d commit 5b3dfb4
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class MediaAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurato
*/
private $request;

/**
* @var int $limit
*/
private $limit;

/**
* @param EntityManager $em The entity manager
* @param MediaManager $mediaManager The media manager
Expand All @@ -50,6 +55,10 @@ public function __construct(
$this->setAdminType(new MediaType($mediaManager, $em));
$this->folder = $folder;
$this->request = $request;

// Thumbnail view should display 24 images, list view 250
$viewMode = $request->get('viewMode', 'thumb-view');
$this->limit = ($viewMode == 'thumb-view') ? 24 : 250;
}

/**
Expand Down Expand Up @@ -114,9 +123,21 @@ public function canDelete($item)
*/
public function getLimit()
{
return 250;
return $this->limit;
}

/**
* @param int $limit
* @return MediaAdminListConfigurator
*/
protected function setLimit($limit)
{
$this->limit = $limit;
return $this;
}



/**
* Add item actions buttons
*/
Expand Down

0 comments on commit 5b3dfb4

Please sign in to comment.