You are here

function _privatemsg_list_thread in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.module \_privatemsg_list_thread()
  2. 6 privatemsg.module \_privatemsg_list_thread()
  3. 7.2 privatemsg.module \_privatemsg_list_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'
privatemsg_list in ./privatemsg.pages.inc

File

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

Code

function _privatemsg_list_thread($tableselect) {
  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';
    }
    foreach ($thread as $key => $data) {

      // First, try to load a specific theme for that field, if not present, use the default.
      if ($return = theme('privatemsg_list_field__' . $key, array(
        'thread' => $thread,
      ))) {

        // The default theme returns nothing, only store the value if we have something.
        $row[$key] = $return;
      }
    }
    $tableselect['#options'][$id] = $row;
  }
  return $tableselect;
}