function _privatemsg_list_thread

1 privatemsg.module _privatemsg_list_thread($thread)
7-1 privatemsg.module _privatemsg_list_thread($tableselect)
7-2 privatemsg.module _privatemsg_list_thread($tableselect)
6-2 privatemsg.module _privatemsg_list_thread($thread)

Formats all rows (#options) in the privatemsg tableselect thread list.

Uses theme patterns to theme single fields.

Parameters

$thread: Array with the row data returned by the database.

Return value

Row definition for use with theme('table')

1 string reference to '_privatemsg_list_thread'

File

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

Code

function _privatemsg_list_thread($tableselect) {
  $enabled_headers = privatemsg_get_enabled_headers();
  $headers = privatemsg_get_headers();

  // 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';

  foreach ($tableselect['#options'] as $id => $thread) {
    $row = array();
    if (!empty($thread['is_new'])) {
      // Set the css class in the tr tag.
      $row['#attributes']['class'][] = 'privatemsg-unread';
    }

    if (!empty($thread['is_replied'])) {
      // Set the css class in the tr tag.
      $row['#attributes']['class'][] = 'privatemsg-replied';
    }


    foreach ($enabled_headers as $key) {
      // Theme each enabled field.
      $row[$key] = theme($headers[$key]['#theme'], array('thread' => $thread));
    }
    $tableselect['#options'][$id] = $row;
  }
  return $tableselect;
}