function ed_classified_view in Classified Ads 5
Same name and namespace in other branches
- 5.2 ed_classified.module \ed_classified_view()
- 6.2 ed_classified.module \ed_classified_view()
- 7.2 ed_classified.module \ed_classified_view()
Implementation of hook_view().
File
- ./
ed_classified.module, line 779 - Simple text-based classified ads module. Michael Curry, Exodus Development, Inc. exodusdev@gmail.com for more information, please visit http://exodusdev.com/drupal/modules/classified.module Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights…
Code
function ed_classified_view(&$node, $teaser = FALSE, $page = FALSE) {
module_load_include('inc', 'ed_classified', 'ed_classified_utils');
if ($page) {
// modify the breadcrumbs and navigation
$vid = _ed_classified_get_vid();
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
$term = array_pop($terms);
if ($term) {
$vocab = taxonomy_vocabulary_load(_ed_classified_get_vid());
// Breadcrumb navigation
$breadcrumb = array();
$breadcrumb[] = l(t('Home'), NULL);
$breadcrumb[] = l($vocab->name, drupal_get_path_alias(EDI_CLASSIFIED_PATH_NAME));
if ($parents = taxonomy_get_parents_all($term->tid)) {
$parents = array_reverse($parents);
foreach ($parents as $p) {
$breadcrumb[] = l($p->name, drupal_get_path_alias(_ed_classified_make_category_path($p->tid)));
}
}
// TODO: do we want to include this item in the breadcrumb?
// $breadcrumb[] = l($node->title, $node->nid); // array('path' => 'node/'. $node->nid);
drupal_set_breadcrumb($breadcrumb);
}
}
$node = node_prepare($node, $teaser);
if ($page) {
$node->content['body']['#value'] = theme('ed_classified_body', $node);
}
else {
if ($teaser) {
$node->content['body']['#value'] = theme('ed_classified_teaser', $node);
}
}
return $node;
}