You are here

private function EntityPagerOut::orderLinks in Entity Pager 7

Order links.

Put links (and count) in the most appropriate order. If extra links have been added from the 4 in the orders array below, they will still appear in the links array.

Parameters

array $links: The links array to be ordered.

Return value

array link. An array of links ordered in the most appropriate way.

1 call to EntityPagerOut::orderLinks()
EntityPagerOut::calculateNextAllPrevValuesFromView in includes/EntityPagerOut.inc
Calculate the values for the links.

File

includes/EntityPagerOut.inc, line 252
Provides the Business Logic for the EntityPager module.

Class

EntityPagerOut
Class EntityPagerOut.

Code

private function orderLinks(array $links) {

  // Define the most usable array order.
  $orders = array(
    'prev',
    'all_link',
    'next',
    'count',
  );
  foreach ($orders as $order) {
    if (isset($links[$order])) {

      // Remove key => value link from middle of array.
      $link = $links[$order];

      // Add the key => value link to the end of  array.
      unset($links[$order]);
      $links[$order] = $link;
    }
  }
  return $links;
}