You are here

function _data_taxonomy_replace_tokens in Data 6

Replaces % in $path with arguments.

@todo: Replace missing % not with 'all' but with value depending on argument setting.

Parameters

$path: A path template like path/%/!tid/%

$args: An array of arguments used to replace % characters in path.

Return value

A path with replaced tokens like path/arg1/!tid/arg2

1 call to _data_taxonomy_replace_tokens()
data_taxonomy_tag_links in data_taxonomy/data_taxonomy.module
Generate a links array suitable for use with theme('links') from an array of taxonomy terms.

File

data_taxonomy/data_taxonomy.module, line 471
Hooks and API functions for Data Node module.

Code

function _data_taxonomy_replace_tokens($path, $args) {
  if (is_array($args)) {
    $args = array_filter($args);
    $pos = strpos($path, '%');
    while ($pos !== FALSE && count($args)) {
      $path = substr_replace($path, array_shift($args), $pos, 1);
      $pos = strpos($path, '%');
    }
  }
  $path = str_replace('%', 'all', $path);
  return $path;
}