Theming documentation

  1. 1 theming
  2. 7-1 theming
  3. 7-2 theming
  4. 6-2 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




./, line 8
Theme functions for privatemsg.


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