You are here

function _message_ui_arguments_update in Message UI 7

A helper function for generate a new array of the message's arguments.

Parameters

Message $message: The message which her arguments need an update.

array $arguments: The new arguments need to be calculated.

2 calls to _message_ui_arguments_update()
message_ui_arguments_update in ./message_ui.module
The message batch or queue item callback function.
message_ui_arguments_worker in ./message_ui.module
Update the message arguments via a queue worker.

File

./message_ui.module, line 595
Main file for the message UI module.

Code

function _message_ui_arguments_update(Message $message, $arguments) {
  $message_arguments = array();
  foreach ($arguments as $token) {

    // Get the hard coded value of the message and him in the message.
    $token_name = str_replace(array(
      '@{',
      '}',
    ), array(
      '[',
      ']',
    ), $token);
    $value = token_replace($token_name, array(
      'message' => $message,
    ));
    $message_arguments[$token] = $value;
  }
  $message->arguments = $message_arguments;
  $message
    ->save();
}