You are here

function data_taxonomy_tag_links in Data 6

Generate a links array suitable for use with theme('links') from an array of taxonomy terms.

Parameters

$terms: An array of terms.

$path: The path template to use (e. g. path/%/!tid/%)

$args: The arguments to use in the path template, used to replace %'s in $path.

2 calls to data_taxonomy_tag_links()
data_taxonomy_ajax_save in data_taxonomy/data_taxonomy.module
AHAH callback for saving terms.
template_preprocess_data_taxonomy_tagging_form in data_taxonomy/data_taxonomy.module
Preprocessor for theme('data_taxonomy_tagging_form').

File

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

Code

function data_taxonomy_tag_links($terms, $path, $args) {
  $tags = array();
  $path = _data_taxonomy_replace_tokens($path, $args);
  foreach ($terms as $tid => $term) {
    $tags[] = array(
      'title' => $term->name,
      'href' => str_replace('!term', $term->name, str_replace('!tid', $term->tid, $path)),
    );
  }
  return $tags;
}