1 path.tokens.inc path_tokens($type, $tokens, array $data = array(), array $options = array())

Implements hook_tokens().

File

core/modules/path/path.tokens.inc, line 24
Token integration for the Path module.

Code

function path_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();

  if ($type == 'array' && !empty($data['array'])) {
    $array = $data['array'];

    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'join-path':
          module_load_include('inc', 'path');
          $values = array();
          foreach ($array as $key => $value) {
            $value = path_clean_string((string) $array[$key], $options);
            $values[] = $value;
          }
          $replacements[$original] = implode('/', $values);
          break;
      }
    }
  }

  return $replacements;
}