You are here

private function user_activity::rebuild_arguments in Heartbeat 6.2

Rebuild the arguments for variables to share within this object

Parameters

array $raw_input of arguments:

2 calls to user_activity::rebuild_arguments()
user_activity::save_locale in ./heartbeat.module
Save activity log with multilingual content and multilingual parts to pre-translate
user_activity::_save in ./heartbeat.module
Save activity log

File

./heartbeat.module, line 168
To fully understand this, you have to be familiar with the rules module. Lots of documentation can be found on http://drupal.org/node/298480 for an introduction and tutorial, but http://drupal.org/node/298486 is a lot of handy info for developers.

Class

user_activity
Class to handle user activity data

Code

private function rebuild_arguments($raw_input, $locale = false) {
  $args = array();
  if ($locale) {

    // Variables that need to be pre-translated go here
    $args['locale'] = array();
  }

  // Rebuild arguments with language tokens
  foreach ($this->m_variables_array as $key => $value) {

    // Leave $key[0] == "!"  asis
    if ($key[0] != "@" && $key[0] != "#") {
      continue;

      // bad argument
    }
    $oldkey = $key;

    // Reset the key of the arguments to ! to parse the next
    // tokenization asis.
    if ($key[0] == "@") {
      $key[0] = "!";
    }

    // # and @ token replacement prefixes are kept,
    // but set a flag for it in the raw_arguments
    if ($key[0] == "#") {
      dsm($key . ' ' . $value);

      // if it has to be translated ...
      if ($locale) {
        $args['locale'][$key] = $value;
      }

      // Now reset the key
      $key[0] = "!";
    }

    // if argument is prefilled, override
    if (isset($raw_args[$oldkey])) {
      $args[$key] = $raw_args[$oldkey];
      continue;
    }

    // Argument gets the value as in variables
    $args[$key] = $value;
  }
  return $args;
}