public function ActivityActionHandler::tokenize in Activity 7
Tokenize based on the provided objects
Parameters
array $objects: The objects used in the tokenization process.
Return value
array An array of messages keyed by language and uid.
File
- ./
activity_action_handlers.inc, line 213
Class
Code
public function tokenize($objects) {
$messages = array();
$languages = array();
foreach ($this->templates as $language_id => $language_patterns) {
foreach ($language_patterns as $target_key => $text) {
$uid = $this
->getUid($target_key, $objects);
if ($uid !== FALSE) {
$options = array(
'clear' => TRUE,
'sanitize' => FALSE,
);
if (drupal_multilingual()) {
if (empty($languages)) {
$languages = language_list();
}
$options['language'] = $languages[$language_id];
}
$message = token_replace($text, $objects, $options);
if (!empty($message)) {
$messages[$language_id][$uid] = $message;
}
}
}
}
return $messages;
}