You are here

public property MessageType::$argument in Message 7

Array with the arguments and their replacement value, or callacbks.

The argument keys will be replaced when rendering the message, and it sohuld be prefixed by @, %, ! - similar to way it's done in Drupal core's t() function.

// Assuming out message-text is:
// %user-name created <a href="@node-url">@node-title</a>
$message_type->arguments = array(
  // Hard code the argument.
  '%user-name' => 'foo',
  // Use a callback, and provide callbacks arguments.
  // The following example will call Drupal core's url() function to
  // get the most up-to-date path of node ID 1.
  '@node-url' => array(
    'callback' => 'url',
    'callback arguments' => array(
      'node/1',
    ),
  ),
  // Use callback, but instead of passing callback argument, we will
  // pass the Message entity itself.
  '@node-title' => array(
    'callback' => 'example_bar',
    'pass message' => TRUE,
  ),
);

Arguments assigned to message-type can be overriden by the ones assigned to the message.

Type: array

See also

message_get_property_values()

File

includes/message.message_type.inc, line 76
A class used for message types.

Class

MessageType
@file A class used for message types.

Code

public $argument = array();