Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Adds option to disable pagination.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jul 20, 2016
1 parent a0e6b95 commit 56f14d2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/Generator/Homepage.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function generate(PageCollection $pageCollection, \Closure $messageCallba
if (!$pageCollection->has('index')) {
$filteredPages = $pageCollection->filter(function (Page $page) {
return $page->getNodeType() === null
&& $page->getSection() == $this->options->get('paginate.homepage.section');
&& $page->getSection() == $this->options->get('site.paginate.homepage.section')
&& !empty($page->getBody());
});
$pages = $filteredPages->sortByDate()->toArray();

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function generate(PageCollection $pageCollection, \Closure $messageCallba
/* @var $page Page */
foreach ($filteredPages as $page) {
$paginate = $this->options->get('site.paginate');
$disabled = ($paginate == 'disabled') ? true : false;

$disabled = array_key_exists('disabled', $paginate) && $paginate['disabled'];
if ($disabled) {
return $generatedPages;
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public function testBuid()
],
],
],
],
'paginate' => [
//'disabled' => true,
'homepage' => [
'section' => 'blog',
'paginate' => [
'disabled' => false,
'homepage' => [
'section' => 'blog',
],
],
],
'static' => [
Expand Down

0 comments on commit 56f14d2

Please sign in to comment.