Theming documentation

  1. privatemsg
    1. 1 privatemsg.theme.inc
    2. 6-2 privatemsg.theme.inc
    3. 7-1 privatemsg.theme.inc
    4. 7-2 privatemsg.theme.inc

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()

Functions & methods

NameDescription
theme_privatemsg_list_fieldDefault theme function for field theme.
theme_privatemsg_list_field__countTheme the replies field.
theme_privatemsg_list_field__last_updatedTheme the last updated column.
theme_privatemsg_list_field__participantsTheme the participants field.
theme_privatemsg_list_field__subjectTheme the subject of the thread.
theme_privatemsg_list_field__thread_startedTheme the thread started column.
theme_privatemsg_list_headerDefine the table header for a specific column.
theme_privatemsg_list_header__countDefine the answers column.
theme_privatemsg_list_header__last_updatedDefine the last updated column.
theme_privatemsg_list_header__participantsDefine the participants column.
theme_privatemsg_list_header__subjectDefine the subject header.
theme_privatemsg_list_header__thread_startedDefine the thread started column.
theme_privatemsg_new_blockTheme a block which displays the number of new messages a user has.
theme_privatemsg_usernameUsed to theme and display user recipients.

File

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

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.