diff --git a/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php b/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php index 0f513f24e..28fd7f59b 100644 --- a/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php @@ -1297,6 +1297,50 @@ class PaginatorHelperTest extends CakeTestCase { array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span', ); $this->assertTags($result, $expected); + + $result = $this->Paginator->numbers(array('first' => 1, 'currentClass' => 'active')); + $expected = array( + array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span', + ' | ', + array('span' => array('class' => 'active')), '2', '/span', + ' | ', + array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span', + ' | ', + array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span', + ' | ', + array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span', + ' | ', + array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span', + ' | ', + array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span', + ' | ', + array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span', + ' | ', + array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span', + ); + $this->assertTags($result, $expected); + + $result = $this->Paginator->numbers(array('first' => 1, 'class' => 'page-link', 'currentClass' => 'active')); + $expected = array( + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span', + ' | ', + array('span' => array('class' => 'active page-link')), '2', '/span', + ' | ', + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span', + ' | ', + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span', + ' | ', + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span', + ' | ', + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span', + ' | ', + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span', + ' | ', + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span', + ' | ', + array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span', + ); + $this->assertTags($result, $expected); $result = $this->Paginator->numbers(array('last' => 1)); $expected = array( diff --git a/lib/Cake/View/Helper/PaginatorHelper.php b/lib/Cake/View/Helper/PaginatorHelper.php index 8812901a2..35ce55837 100644 --- a/lib/Cake/View/Helper/PaginatorHelper.php +++ b/lib/Cake/View/Helper/PaginatorHelper.php @@ -642,6 +642,8 @@ class PaginatorHelper extends AppHelper { * - `last` Whether you want last links generated, set to an integer to define the number of 'last' * links to generate. * - `ellipsis` Ellipsis content, defaults to '...' + * - `class` Class for wrapper tag + * - `currentClass` Class for wrapper tag on current active page, defaults to 'current' * * @param mixed $options Options for the numbers, (before, after, model, modulus, separator) * @return string numbers string. @@ -656,7 +658,7 @@ class PaginatorHelper extends AppHelper { $defaults = array( 'tag' => 'span', 'before' => null, 'after' => null, 'model' => $this->defaultModel(), 'class' => null, - 'modulus' => '8', 'separator' => ' | ', 'first' => null, 'last' => null, 'ellipsis' => '...', + 'modulus' => '8', 'separator' => ' | ', 'first' => null, 'last' => null, 'ellipsis' => '...', 'currentClass' => 'current' ); $options += $defaults; @@ -670,7 +672,7 @@ class PaginatorHelper extends AppHelper { extract($options); unset($options['tag'], $options['before'], $options['after'], $options['model'], $options['modulus'], $options['separator'], $options['first'], $options['last'], - $options['ellipsis'], $options['class'] + $options['ellipsis'], $options['class'], $options['currentClass'] ); $out = ''; @@ -704,7 +706,6 @@ class PaginatorHelper extends AppHelper { . $separator; } - $currentClass = 'current'; if ($class) { $currentClass .= ' ' . $class; }