You are here

function _privatemsg_list_headers in Privatemsg 7

Same name and namespace in other branches
  1. 6 privatemsg.module \_privatemsg_list_headers()

Returns a table header definition based on the submitted keys.

Uses theme patterns to theme single headers.

Parameters

$has_posts: TRUE when there is at least one row. Decides if the select all checkbox should be displayed.

$keys: Array with the keys which are present in the query/should be displayed.

Return value

Array with header definitions for tablesort_sql and theme('table').

1 call to _privatemsg_list_headers()
privatemsg_list in ./privatemsg.pages.inc

File

./privatemsg.module, line 2138
Allows users to send private messages to other users.

Code

function _privatemsg_list_headers($keys) {

  // theme() doesn't include the theme file for patterns, we need to do it manually.
  include_once drupal_get_path('module', 'privatemsg') . '/privatemsg.theme.inc';
  $header = array();
  foreach ($keys as $key) {

    // First, try to load a specific theme for that header, if not present, use the default.
    if ($return = theme('privatemsg_list_header__' . $key)) {

      // The default theme returns nothing, only store the value if we have something.
      $header[$key] = $return;
    }
  }
  uasort($header, 'element_sort');

  // Remove weight column or it will show up in the markup.
  foreach ($header as $key => $element) {
    if (isset($header[$key]['#weight'])) {
      unset($header[$key]['#weight']);
    }
  }
  return $header;
}