Skip to content

Instantly share code, notes, and snippets.

@mbabker
Created July 22, 2016 14:39
Show Gist options
  • Save mbabker/41c6b172ced159f85707dd4154cc934a to your computer and use it in GitHub Desktop.
Save mbabker/41c6b172ced159f85707dd4154cc934a to your computer and use it in GitHub Desktop.
Forward Compatible pagination.php file
<?php
/**
* Joomla.org site template
*
* @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('_JEXEC') or die;
/**
* This is a file to add template specific chrome to pagination rendering.
*
* pagination_list_footer
* Input variable $list is an array with offsets:
* $list[limit] : int
* $list[limitstart] : int
* $list[total] : int
* $list[limitfield] : string
* $list[pagescounter] : string
* $list[pageslinks] : string
*
* pagination_list_render
* Input variable $list is an array with offsets:
* $list[all]
* [data] : string
* [active] : boolean
* $list[start]
* [data] : string
* [active] : boolean
* $list[previous]
* [data] : string
* [active] : boolean
* $list[next]
* [data] : string
* [active] : boolean
* $list[end]
* [data] : string
* [active] : boolean
* $list[pages]
* [{PAGE}][data] : string
* [{PAGE}][active] : boolean
*
* pagination_item_active
* Input variable $item is an object with fields:
* $item->base : integer
* $item->link : string
* $item->text : string
*
* pagination_item_inactive
* Input variable $item is an object with fields:
* $item->base : integer
* $item->link : string
* $item->text : string
*
* This gives template designers ultimate control over how pagination is rendered.
*
* NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST override them both
*/
/**
* Renders the pagination list
*
* @param array $list Array containing pagination information
*
* @return string HTML markup for the full pagination object
*/
function pagination_list_render($list)
{
return JLayoutHelper::render('joomla.pagination.list', ['list' => $list]);
}
/**
* Renders an active item in the pagination block
*
* @param JPaginationObject $item The current pagination object
*
* @return string HTML markup for active item
*/
function pagination_item_active(&$item)
{
return JLayoutHelper::render('joomla.pagination.link', ['data' => $item, 'active' => true]);
}
/**
* Renders an inactive item in the pagination block
*
* @param JPaginationObject $item The current pagination object
*
* @return string HTML markup for inactive item
*/
function pagination_item_inactive(&$item)
{
return JLayoutHelper::render('joomla.pagination.link', ['data' => $item, 'active' => false]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment