Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MediaBundle] Paginate Image thumbnail view to 24 images (6 rows of 4) per page #1633

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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