mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 10:36:16 +00:00
Paginator Helper prev and next methods now use the Html::tag helper method, allowing you to pass a tag option to specify what HTML tag the disabled links should be wrapped in. Defaults to div. Fixes #3991
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6862 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
dd7aa25a20
commit
09ebd9cbe6
2 changed files with 8 additions and 4 deletions
|
@ -289,7 +289,7 @@ class PaginatorHelper extends AppHelper {
|
|||
*/
|
||||
function __pagingLink($which, $title = null, $options = array(), $disabledTitle = null, $disabledOptions = array()) {
|
||||
$check = 'has' . $which;
|
||||
$_defaults = array('url' => array(), 'step' => 1, 'escape' => true, 'model' => null);
|
||||
$_defaults = array('url' => array(), 'step' => 1, 'escape' => true, 'model' => null, 'tag' => 'div');
|
||||
$options = array_merge($_defaults, (array)$options);
|
||||
$paging = $this->params($options['model']);
|
||||
|
||||
|
@ -311,7 +311,7 @@ class PaginatorHelper extends AppHelper {
|
|||
if ($this->{$check}()) {
|
||||
return $this->link($title, $url, array_merge($options, array('escape' => $escape)));
|
||||
} else {
|
||||
return $this->Html->div(null, $title, $options, $escape);
|
||||
return $this->Html->tag($tag, $title, $options, $escape);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -89,8 +89,8 @@ class PaginatorTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->Paginator->params['paging']['Article']['prevPage'] = false;
|
||||
$result = $this->Paginator->prev('prev', array('update'=> 'theList', 'indicator'=> 'loading', 'url'=> array('controller' => 'posts')), null, array('class' => 'disabled'));
|
||||
$expected = '<div class="disabled">prev</div>';
|
||||
$result = $this->Paginator->prev('prev', array('update'=> 'theList', 'indicator'=> 'loading', 'url'=> array('controller' => 'posts')), null, array('class' => 'disabled', 'tag' => 'span'));
|
||||
$expected = '<span class="disabled">prev</span>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
|
@ -204,6 +204,10 @@ class PaginatorTest extends UnitTestCase {
|
|||
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
|
||||
$expected = '<div class="disabled"><< Previous</div>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled', 'tag' => 'span'));
|
||||
$expected = '<span class="disabled"><< Previous</span>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->Paginator->params['paging']['Client']['page'] = 2;
|
||||
$this->Paginator->params['paging']['Client']['prevPage'] = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue