Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/add-missing-scrollingstyle' of https://github.co…
Browse files Browse the repository at this point in the history
…m/arse/zf2 into hotfix/paginator-default-scroll-style
  • Loading branch information
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions src/Helper/PaginationControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ class PaginationControl extends AbstractHelper
*
* @var string|array
*/
protected static $_defaultViewPartial = null;
protected static $defaultViewPartial = null;

/**
* Default Scrolling Style
*
* @var string
*/
protected static $defaultScrollingStyle = 'sliding';

/**
* Sets the default view partial.
Expand All @@ -34,7 +41,7 @@ class PaginationControl extends AbstractHelper
*/
public static function setDefaultViewPartial($partial)
{
self::$_defaultViewPartial = $partial;
self::$defaultViewPartial = $partial;
}

/**
Expand All @@ -44,7 +51,27 @@ public static function setDefaultViewPartial($partial)
*/
public static function getDefaultViewPartial()
{
return self::$_defaultViewPartial;
return self::$defaultViewPartial;
}

/**
* Gets the default scrolling style
*
* @return string
*/
public static function getDefaultScrollingStyle()
{
return self::$defaultScrollingStyle;
}

/**
* Sets the default Scrolling Style
*
* @param type $style string 'all' | 'elastic' | 'sliding' | 'jumping'
*/
public static function setDefaultScrollingStyle($style)
{
self::$defaultScrollingStyle = $style;
}

/**
Expand All @@ -71,11 +98,15 @@ public function __invoke(Paginator\Paginator $paginator = null, $scrollingStyle
}

if ($partial === null) {
if (self::$_defaultViewPartial === null) {
if (self::$defaultViewPartial === null) {
throw new Exception\RuntimeException('No view partial provided and no default set');
}

$partial = self::$_defaultViewPartial;
$partial = self::$defaultViewPartial;
}

if ($scrollingStyle === null) {
$scrollingStyle = self::$defaultScrollingStyle;
}

$pages = get_object_vars($paginator->getPages($scrollingStyle));
Expand Down

0 comments on commit 08b2a78

Please sign in to comment.