function i18n_taxonomy_term_page in Internationalization 7
Menu callback; displays all nodes associated with a term.
Parameters
$term: The taxonomy term.
Return value
The page content.
1 string reference to 'i18n_taxonomy_term_page'
- i18n_taxonomy_menu_alter in i18n_taxonomy/
i18n_taxonomy.module - Implements hook_menu_alter().
File
- i18n_taxonomy/
i18n_taxonomy.pages.inc, line 16 - Page callbacks for the taxonomy module, i18n remake.
Code
function i18n_taxonomy_term_page($term) {
$term = i18n_taxonomy_localize_terms($term);
// Assign the term name as the page title.
drupal_set_title($term->name);
// Build breadcrumb based on the hierarchy of the term.
$current = (object) array(
'tid' => $term->tid,
);
// @todo This overrides any other possible breadcrumb and is a pure hard-coded
// presumption. Make this behavior configurable per vocabulary or term.
$breadcrumb = array();
while ($parents = taxonomy_get_parents($current->tid)) {
$parents = i18n_taxonomy_localize_terms($parents);
$current = array_shift($parents);
$breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid);
}
$breadcrumb[] = l(t('Home'), NULL);
$breadcrumb = array_reverse($breadcrumb);
drupal_set_breadcrumb($breadcrumb);
drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);
$build = array();
$build['term_heading'] = array(
'#prefix' => '<div class="term-listing-heading">',
'#suffix' => '</div>',
'term' => taxonomy_term_view($term, 'full'),
);
if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
$nodes = node_load_multiple($nids);
$build += node_view_multiple($nodes);
$build['pager'] = array(
'#theme' => 'pager',
'#weight' => 5,
);
}
else {
$build['no_content'] = array(
'#prefix' => '<p>',
'#markup' => t('There is currently no content classified with this term.'),
'#suffix' => '</p>',
);
}
return $build;
}