You are here

Theming documentation in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.theme.inc \theming
  2. 6 privatemsg.theme.inc \theming
  3. 7.2 privatemsg.theme.inc \theming

It is possible to theme every aspect of privatemsg with theme functions.

For the thread list, so called theme patterns are used to allow flexible theming of the table and its columns (including columns added by other modules).

Three requirements have to be fulfilled so a new column, with data, is displayed in the private message list:

  • A field needs to be returned by the list query, see Query Builder.
  • A header theme pattern needs to exist for the field.
  • A field theme pattern needs to exist for the field.

For each field in the query, Privatemsg will try to call a theme pattern for the header. That theme function can return a table header definition and has the following structure: theme_privatemsg_list_header_fieldname.

Privatemsg will then do the same for each row, with the field theme pattern. That theme function should return a table field compatible structure, either just a string or an array. The theme function has to have the following name: theme_privatemsg_list_field_fieldname.

To override an already existing theme function, use the following structure: themename_privatemsg_list_field_fieldname. It is not necessary to overwrite the header theme function unless that information needs to be changed too.

Modules can use the hook_form_alter() hook to alter the data. The form with id "privatemsg_list" will contain the header, raw and themed field data in the following form:


$form['#headers']['field_name'] = $header // Array with the header definition;
$form['#data']['thread_id'] = $data // Raw data of that thread
$form['#rows']['thread_id'] = $row // Themed fields of that thread

Note that the information in #data can be used to populate #rows, but it will not be used by the default theme function theme_privatemsg_list().

See also

theme_privatemsg_list_header()

theme_privatemsg_list_field()

File

./privatemsg.theme.inc, line 8
Theme functions for privatemsg.

Functions

Namesort descending Location Description
theme_privatemsg_list_field ./privatemsg.theme.inc Default theme function for field theme.
theme_privatemsg_list_field__count ./privatemsg.theme.inc Theme the replies field.
theme_privatemsg_list_field__last_updated ./privatemsg.theme.inc Theme the last updated column.
theme_privatemsg_list_field__participants ./privatemsg.theme.inc Theme the participants field.
theme_privatemsg_list_field__subject ./privatemsg.theme.inc Theme the subject of the thread.
theme_privatemsg_list_field__thread_started ./privatemsg.theme.inc Theme the thread started column.
theme_privatemsg_list_header ./privatemsg.theme.inc Define the table header for a specific column.
theme_privatemsg_list_header__count ./privatemsg.theme.inc Define the answers column.
theme_privatemsg_list_header__last_updated ./privatemsg.theme.inc Define the last updated column.
theme_privatemsg_list_header__participants ./privatemsg.theme.inc Define the participants column.
theme_privatemsg_list_header__subject ./privatemsg.theme.inc Define the subject header.
theme_privatemsg_list_header__thread_started ./privatemsg.theme.inc Define the thread started column.
theme_privatemsg_new_block ./privatemsg.theme.inc Theme a block which displays the number of new messages a user has.
theme_privatemsg_username ./privatemsg.theme.inc Used to theme and display user recipients.