taxonomy_link

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/taxonomy/taxonomy.module, строка 27

Версии
5 – 6
taxonomy_link($type, $node = NULL)

Реализация hook_link().

Этот хук дополняется $type = 'taxonomy terms', чтобы можно было темизировать вывод списков терминов, которые ассоциированны с нодой. Темы могут выводить ссылки таксономии так:

if (module_exists('taxonomy')) {
  $terms = taxonomy_link('taxonomy terms', $node);
  print theme('links', $terms);
}

▾ 3 функции вызывают taxonomy_link()

chameleon_node in themes/chameleon/chameleon.theme
phptemplate_node in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_node function to be passed into a pluggable template engine.
theme_node in includes/theme.inc
Возвращает темизированную ноду.

Код

<?php
function taxonomy_link($type, $node = NULL) {
  if ($type == 'taxonomy terms' && $node != NULL) {
    $links = array();
    if (array_key_exists('taxonomy', $node)) {
      foreach ($node->taxonomy as $term) {
        $links['taxonomy_term_'. $term->tid] = array(
          'title' => $term->name,
          'href' => taxonomy_term_path($term),
          'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
        );
      }
    }

    // We call this hook again because some modules and themes call taxonomy_link('taxonomy terms') directly
    foreach (module_implements('link_alter') as $module) {
      $function = $module .'_link_alter';
      $function($node, $links);
    }

    return $links;
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему