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

Move pagination list rendering to layout #10982

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
25 changes: 25 additions & 0 deletions layouts/joomla/pagination/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_BASE') or die;

$list = $displayData['list'];
?>
<ul>
<li class="pagination-start"><?php echo $list['start']['data']; ?></li>
<li class="pagination-prev"><?php echo $list['previous']['data']; ?></li>
<?php
foreach ($list['pages'] as $page)
{
echo '<li>' . $page['data'] . '</li>';
}
?>
<li class="pagination-next"><?php echo $list['next']['data']; ?></li>
<li class="pagination-end"><?php echo $list['end']['data']; ?></li>
</ul>
20 changes: 5 additions & 15 deletions libraries/cms/pagination/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ public function getPagesLinks()
$itemOverride = true;
}

/*
* @deprecated The list rendering is now a layout.
* @see JPagination::_list_render()
*/
if (function_exists('pagination_list_render'))
{
$listOverride = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a JLog statement in this if conditional too? That way it gets picked up by anyone with deprecation logging enabled.

Expand Down Expand Up @@ -672,21 +676,7 @@ protected function _list_footer($list)
*/
protected function _list_render($list)
{
// Reverse output rendering for right-to-left display.
$html = '<ul>';
$html .= '<li class="pagination-start">' . $list['start']['data'] . '</li>';
$html .= '<li class="pagination-prev">' . $list['previous']['data'] . '</li>';

foreach ($list['pages'] as $page)
{
$html .= '<li>' . $page['data'] . '</li>';
}

$html .= '<li class="pagination-next">' . $list['next']['data'] . '</li>';
$html .= '<li class="pagination-end">' . $list['end']['data'] . '</li>';
$html .= '</ul>';

return $html;
return JLayoutHelper::render('joomla.pagination.list', array('list' => $list));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ public function testGetPagesLinks($total, $limitstart, $limit, $expected)

$result = $pagination->getPagesLinks();

$this->assertEquals($result, $expected, 'The expected output of the pagination is incorrect');
$replaces = array("\n", "\r"," ", "\t");

$this->assertEquals(str_replace($replaces, '', $result), str_replace($replaces, '', $expected), 'The expected output of the pagination is incorrect');

unset($pagination);
}
Expand Down Expand Up @@ -651,7 +653,9 @@ public function testListRender($list, $total, $limitstart, $limit ,$expected)

$string = TestReflection::invoke($pagination, '_list_render', $list);

$this->assertEquals($string, $expected, 'The list render method is not outputting the expected results');
$replaces = array("\n", "\r"," ", "\t");

$this->assertEquals(str_replace($replaces, '', $string), str_replace($replaces, '', $expected), 'The list render method is not outputting the expected results');

unset($pagination);
}
Expand Down