/** * Split out taxonomy terms by vocabulary. * * @param $node * An object providing all relevant information for displaying a node: * - $node->nid: The ID of the node. * - $node->type: The content type (story, blog, forum...). * - $node->title: The title of the node. * - $node->created: The creation date, as a UNIX timestamp. * - $node->teaser: A shortened version of the node body. * - $node->body: The entire node contents. * - $node->changed: The last modification date, as a UNIX timestamp. * - $node->uid: The ID of the author. * - $node->username: The username of the author. * * @ingroup themeable */ function art_terms_worker($node) { $output = ''; if (isset($node->links)) { $output = ' | '; } $terms = $node->taxonomy; if ($terms) { $links = array(); ob_start(); ?> <img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?> /images/PostTagIcon.png" width="18" height="18" alt="PostTagIcon"/> <?php $output .= ob_get_clean(); $output .= t('Tags: '); foreach ($terms as $term) { $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description))); } $output .= implode(', ', $links); $output .= ', '; } $output = substr($output, 0, strlen($output) - 2); // removes last comma with space return $output; }
function phptemplate_taxonomy_links($node, $vid) { if (count($node->taxonomy)) { $tags = array(); foreach ($node->taxonomy as $term) { if ($term->vid == $vid) { $tags[] = array('title' => $term->name, 'href' => taxonomy_term_path($term), 'attributes' => array('rel' => 'tag')); } } if ($tags) { return theme_links($tags, array('class' => 'links inline')); } } }
function light_print_terms($nid) { $vocabularies = taxonomy_get_vocabularies(); $output = ''; foreach ($vocabularies as $vocabulary) { if ($vocabularies) { $terms = taxonomy_node_get_terms_by_vocabulary($nid, $vocabulary->vid); if ($terms) { $links = array(); //$output .= '' . $vocabulary->name . ': '; foreach ($terms as $term) { $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description))); } $output .= implode(', ', $links); } } } return $output; }
/** * Intercept node template variables * * @param $vars * A sequential array of variables passed to the theme function. */ function vozmob_white_label_preprocess_node(&$vars) { jquery_plugin_add('cycle', 'theme', 'header'); jquery_plugin_add('expose'); jquery_plugin_add('overlay'); drupal_add_js(drupal_get_path('theme', 'vozmob_white_label') . '/scripts/cycle.js', 'theme'); $node = $vars['node']; // for easy reference // for easy variable adding for different node types // jquery_plugin_add('jquery.sound'); // drupal_add_js(drupal_get_path('theme', 'vozmob_white_label') . '/scripts/jquery.sound.js', 'theme'); // Hackish way of adding video thumbnail into the node view. // This should get cleaned up (e.g. using CCK to render media mover video). $vars['overlay_launcher'] = FALSE; if (empty($node->field_image[0]['view']) && !empty($node->media_mover)) { foreach ($node->media_mover as $cid) { foreach ($cid as $mmfid) { if (substr($mmfid['complete_file'], -4, 4) == '.jpg') { $vars['overlay_launcher'] = TRUE; $vars['overlay_launcher_image'] = $mmfid['complete_file']; break 2; } } } } // Hackish way of adding audio overlay launcher into the node view. // This should get cleaned up (e.g. using CCK to render media mover audio). if (!$vars['overlay_launcher'] && empty($node->field_image[0]['view']) && !empty($node->media_mover)) { foreach ($node->media_mover as $cid) { foreach ($cid as $mmfid) { if (substr($mmfid['complete_file'], -4, 4) == '.mp3') { $vars['overlay_launcher'] = TRUE; $vars['overlay_launcher_image'] = drupal_get_path('theme', 'vozmob_white_label') . '/images/' . ($vars['teaser'] ? 'audio_icon_whitebg.gif' : 'audio_icon_large.gif'); break 2; } } } } // split term by vocabulary and format appropriatly $vocabulary = array(); foreach ($node->taxonomy as $tid => $term) { $vocabulary[$term->vid]['taxonomy_term_' . $term->tid] = array('tid' => $term->tid, 'name' => $term->name, 'title' => $term->name, 'href' => taxonomy_term_path($term), 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)), 'path' => taxonomy_term_path($term)); } // tags $vars['terms'] = theme('links', $vocabulary[1], array('class' => 'links inline')); if (module_exists('uploadterm') && module_exists('taxonomy_image')) { // media terms $term_image_links = array(); foreach ($vocabulary[variable_get('uploadterm_vocabulary', 0)] as $term) { $term_image_links[] = l(taxonomy_image_display($term['tid']), $term['path'], array('html' => TRUE)); // can add size here } $vars['mediaterms'] = theme('item_list', $term_image_links, NULL, 'ul', array('class' => 'links inline media')); } switch ($node->type) { case 'page': break; // case 'slideshow': //add the sound plugin // jquery_plugin_add('jquery.sound'); // drupal_add_js(drupal_get_path('theme', 'vozmob_white_label') . '/scripts/jquery.sound.js', 'theme'); } }
/** * Implementation of template_preprocess_node(). */ function csa_base_preprocess_node(&$variables) { // Add meaningfull classes to the node. $node_classes = array(); $node_classes[] = 'node'; $node_classes[] = 'node-' . $variables['node']->type; if (empty($variables['status'])) { $node_classes[] = 'node-unpublished'; } $variables['node_classes'] = implode(' ', $node_classes); // Date & author. $date = t('Posted ') . format_date($variables['node']->created, 'medium'); // Format date as small, medium, or large $author = theme('username', $variables['node']); $author_only_separator = t('Posted by '); $author_date_separator = t(' by '); $submitted_by_content_type = theme_get_setting('submitted_by_enable_content_type') == 1 ? $variables['node']->type : 'default'; $date_setting = theme_get_setting('submitted_by_date_' . $submitted_by_content_type) == 1; $author_setting = theme_get_setting('submitted_by_author_' . $submitted_by_content_type) == 1; $author_separator = $date_setting ? $author_date_separator : $author_only_separator; $date_author = $date_setting ? $date : ''; $date_author .= $author_setting ? $author_separator . $author : ''; $variables['submitted'] = $date_author; if (theme_get_setting('hide_front_page_title') && drupal_is_front_page()) { $variables['submitted'] = NULL; } $taxonomy_content_type = theme_get_setting('taxonomy_enable_content_type') == 1 ? $variables['node']->type : 'default'; $taxonomy_display = theme_get_setting('taxonomy_display_' . $taxonomy_content_type); $taxonomy_format = theme_get_setting('taxonomy_format_' . $taxonomy_content_type); $taxonomy_format_links = theme_get_setting('taxonomy_format_links'); if (module_exists('taxonomy') && ($taxonomy_display == 'all' || $taxonomy_display == 'only' && $variables['page'])) { $output = array(); $vocabularies = taxonomy_get_vocabularies($variables['node']->type); foreach ($vocabularies as $vocabulary) { if (theme_get_setting('taxonomy_vocab_display_' . $taxonomy_content_type . '_' . $vocabulary->vid)) { $terms = taxonomy_node_get_terms_by_vocabulary($variables['node'], $vocabulary->vid); if ($terms) { $links = array(); foreach ($terms as $term) { $links[] = array('data' => l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)))), 'class' => 'vocab-term'); } if ($taxonomy_format == 'vocab') { $data = theme_get_setting('taxonomy_display_vocab_name') ? '<span class="vocab-name">' . $vocabulary->name . ':</span> ' : ''; $class = array('vocab'); $children = array(); if ($taxonomy_format_links) { $class[] = 'links'; $children = $links; } else { $term_list = array(); foreach ($links as $link) { $term_list[] = $link['data']; } $data .= implode(theme_get_setting('taxonomy_format_delimiter'), $term_list); } $output[] = array('data' => $data, 'class' => implode(' ', $class), 'id' => 'vocab-' . $vocabulary->vid, 'children' => $children); } else { $output = array_merge($links, $output); } } } } $variables['terms'] = theme('item_list', $output, null, 'ul', array('class' => 'taxonomy')); } else { $variables['terms'] = ''; } }
/** * Modifyied Theme Function theme_tagadelic_weighted * render tags **/ function alim_tagadelic_weighted($terms) { $output = ''; foreach ($terms as $term) { //print '..'.arg(2); if( arg(0) == 'taxonomy' && arg(1) == 'term' && arg(2) == $term->tid ){ $output .= ''; //print '**'; } else{ $output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic level$term->weight", 'rel' => 'tag'))) ." \n"; //print '@@'; } } return $output; }
/** * theme function that renders the HTML for the tags * @ingroup themable */ function phptemplate_tagadelic_weighted($terms) { foreach ($terms as $term) { $output .= l(t($term->name), taxonomy_term_path($term), array('class' => "tagadelic level{$term->weight}", 'rel' => 'tag')) . " \n"; } return $output; }
function art_terms_worker($terms) { $output = ''; if (!empty($terms)) { $links = array(); ob_start(); ?> <?php $output .= ob_get_clean(); $output .= t('Tags: '); foreach ($terms as $term) { $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description))); } $output .= implode(', ', $links); $output .= ', '; } $output = substr($output, 0, strlen($output) - 2); // removes last comma with space return $output; }
function acquia_marina_preprocess_node(&$vars) { // Build array of handy node classes $node_classes = array(); $node_classes[] = $vars['zebra']; // Node is odd or even $node_classes[] = !$vars['node']->status ? 'node-unpublished' : ''; // Node is unpublished $node_classes[] = $vars['sticky'] ? 'sticky' : ''; // Node is sticky $node_classes[] = isset($vars['node']->teaser) ? 'teaser' : 'full-node'; // Node is teaser or full-node $node_classes[] = 'node-type-' . $vars['node']->type; // Node is type-x, e.g., node-type-page $node_classes = array_filter($node_classes); // Remove empty elements $vars['node_classes'] = implode(' ', $node_classes); // Implode class list with spaces // Add node_bottom region content $vars['node_bottom'] = theme('blocks', 'node_bottom'); // Node Theme Settings // Date & author if (!module_exists('submitted_by')) { $date = t('Posted ') . format_date($vars['node']->created, 'medium'); // Format date as small, medium, or large $author = theme('username', $vars['node']); $author_only_separator = t('Posted by '); $author_date_separator = t(' by '); $submitted_by_content_type = theme_get_setting('submitted_by_enable_content_type') == 1 ? $vars['node']->type : 'default'; $date_setting = theme_get_setting('submitted_by_date_' . $submitted_by_content_type) == 1; $author_setting = theme_get_setting('submitted_by_author_' . $submitted_by_content_type) == 1; $author_separator = $date_setting ? $author_date_separator : $author_only_separator; $date_author = $date_setting ? $date : ''; $date_author .= $author_setting ? $author_separator . $author : ''; $vars['submitted'] = $date_author; } // Taxonomy $taxonomy_content_type = theme_get_setting('taxonomy_enable_content_type') == 1 ? $vars['node']->type : 'default'; $taxonomy_display = theme_get_setting('taxonomy_display_' . $taxonomy_content_type); $taxonomy_format = theme_get_setting('taxonomy_format_' . $taxonomy_content_type); if (module_exists('taxonomy') && ($taxonomy_display == 'all' || $taxonomy_display == 'only' && $vars['page'])) { $vocabularies = taxonomy_get_vocabularies($vars['node']->type); $output = ''; $term_delimiter = ', '; foreach ($vocabularies as $vocabulary) { if (theme_get_setting('taxonomy_vocab_hide_' . $taxonomy_content_type . '_' . $vocabulary->vid) != 1) { $terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid); if ($terms) { $term_items = ''; foreach ($terms as $term) { // Build vocabulary term items $term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)))); $term_items .= '<li class="vocab-term">' . $term_link . $term_delimiter . '</li>'; } if ($taxonomy_format == 'vocab') { // Add vocabulary labels if separate $output .= '<li class="vocab vocab-' . $vocabulary->vid . '"><span class="vocab-name">' . $vocabulary->name . ':</span> <ul class="vocab-list">'; $output .= substr_replace($term_items, '</li>', -(strlen($term_delimiter) + 5)) . '</ul></li>'; } else { $output .= $term_items; } } } } if ($output != '') { $output = $taxonomy_format == 'list' ? substr_replace($output, '</li>', -(strlen($term_delimiter) + 5)) : $output; $output = '<ul class="taxonomy">' . $output . '</ul>'; } $vars['terms'] = $output; } else { $vars['terms'] = ''; } // Node Links if (isset($vars['node']->links['node_read_more'])) { $node_content_type = theme_get_setting('readmore_enable_content_type') == 1 ? $vars['node']->type : 'default'; $vars['node']->links['node_read_more'] = array('title' => acquia_marina_themesettings_link(theme_get_setting('readmore_prefix_' . $node_content_type), theme_get_setting('readmore_suffix_' . $node_content_type), t(theme_get_setting('readmore_' . $node_content_type)), 'node/' . $vars['node']->nid, array('attributes' => array('title' => t(theme_get_setting('readmore_title_' . $node_content_type))), 'query' => NULL, 'fragment' => NULL, 'absolute' => FALSE, 'html' => TRUE)), 'attributes' => array('class' => 'readmore-item'), 'html' => TRUE); } if (isset($vars['node']->links['comment_add'])) { $node_content_type = theme_get_setting('comment_enable_content_type') == 1 ? $vars['node']->type : 'default'; if ($vars['teaser']) { $vars['node']->links['comment_add'] = array('title' => acquia_marina_themesettings_link(theme_get_setting('comment_add_prefix_' . $node_content_type), theme_get_setting('comment_add_suffix_' . $node_content_type), t(theme_get_setting('comment_add_' . $node_content_type)), "comment/reply/" . $vars['node']->nid, array('attributes' => array('title' => t(theme_get_setting('comment_add_title_' . $node_content_type))), 'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE)), 'attributes' => array('class' => 'comment-add-item'), 'html' => TRUE); } else { $vars['node']->links['comment_add'] = array('title' => acquia_marina_themesettings_link(theme_get_setting('comment_node_prefix_' . $node_content_type), theme_get_setting('comment_node_suffix_' . $node_content_type), t(theme_get_setting('comment_node_' . $node_content_type)), "comment/reply/" . $vars['node']->nid, array('attributes' => array('title' => t(theme_get_setting('comment_node_title_' . $node_content_type))), 'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE)), 'attributes' => array('class' => 'comment-node-item'), 'html' => TRUE); } } if (isset($vars['node']->links['comment_new_comments'])) { $node_content_type = theme_get_setting('comment_enable_content_type') == 1 ? $vars['node']->type : 'default'; $vars['node']->links['comment_new_comments'] = array('title' => acquia_marina_themesettings_link(theme_get_setting('comment_new_prefix_' . $node_content_type), theme_get_setting('comment_new_suffix_' . $node_content_type), format_plural(comment_num_new($vars['node']->nid), t(theme_get_setting('comment_new_singular_' . $node_content_type)), t(theme_get_setting('comment_new_plural_' . $node_content_type))), "node/" . $vars['node']->nid, array('attributes' => array('title' => t(theme_get_setting('comment_new_title_' . $node_content_type))), 'query' => NULL, 'fragment' => 'new', 'absolute' => FALSE, 'html' => TRUE)), 'attributes' => array('class' => 'comment-new-item'), 'html' => TRUE); } if (isset($vars['node']->links['comment_comments'])) { $node_content_type = theme_get_setting('comment_enable_content_type') == 1 ? $vars['node']->type : 'default'; $vars['node']->links['comment_comments'] = array('title' => acquia_marina_themesettings_link(theme_get_setting('comment_prefix_' . $node_content_type), theme_get_setting('comment_suffix_' . $node_content_type), format_plural(comment_num_all($vars['node']->nid), t(theme_get_setting('comment_singular_' . $node_content_type)), t(theme_get_setting('comment_plural_' . $node_content_type))), "node/" . $vars['node']->nid, array('attributes' => array('title' => t(theme_get_setting('comment_title_' . $node_content_type))), 'query' => NULL, 'fragment' => 'comments', 'absolute' => FALSE, 'html' => TRUE)), 'attributes' => array('class' => 'comment-item'), 'html' => TRUE); } $vars['links'] = theme('links', $vars['node']->links, array('class' => 'links inline')); }
function zeropoint_preprocess_node(&$vars) { $vars['template_files'][] = 'node-' . $vars['nid']; //print_r($vars); if ($vars['user']->uid) { $vars['content'] = preg_replace('~<foranonym>.*</foranonym>~s', '', $vars['content']); } $vars['content'] = preg_replace('~"http://baza-voprosov.ru/~', '"/', $vars['content']); // Build array of handy node classes $node_classes = array(); $node_classes[] = $vars['zebra']; // Node is odd or even $node_classes[] = !$vars['node']->status ? 'node-unpublished' : ''; // Node is unpublished $node_classes[] = $vars['sticky'] ? 'sticky' : ''; // Node is sticky $node_classes[] = isset($vars['node']->teaser) ? 'teaser' : 'full-node'; // Node is teaser or full-node $node_classes[] = 'node-type-' . $vars['node']->type; // Node is type-x, e.g., node-type-page // Add any taxonomy terms for node teasers if ($vars['teaser'] && isset($vars['taxonomy'])) { foreach ($vars['taxonomy'] as $taxonomy_id_string => $term_info) { $taxonomy_id = array_pop(explode('_', $taxonomy_id_string)); $node_classes[] = 'tag-' . $taxonomy_id; // Node teaser has terms (tag-x) // $taxonomy_name = id_safe($term_info['title']); // if ($taxonomy_name) { // $node_classes[] = 'tag-'. $taxonomy_name; // Node teaser has terms (tag-name) // } } } $node_classes = array_filter($node_classes); // Remove empty elements $vars['node_classes'] = implode(' ', $node_classes); // Implode class list with spaces // Add node regions $vars['node_middle'] = theme('blocks', 'node_middle'); $vars['node_bottom'] = theme('blocks', 'node_bottom'); // Render Ubercart fields into separate variables for node-product.tpl.php if (module_exists('uc_product') && uc_product_is_product($vars) && $vars['template_files'][0] == 'node-product') { $node = node_build_content(node_load($vars['nid'])); $vars['uc_image'] = drupal_render($node->content['image']); $vars['uc_body'] = drupal_render($node->content['body']); $vars['uc_display_price'] = drupal_render($node->content['display_price']); $vars['uc_add_to_cart'] = drupal_render($node->content['add_to_cart']); $vars['uc_weight'] = drupal_render($node->content['weight']); $vars['uc_dimensions'] = drupal_render($node->content['dimensions']); $vars['uc_model'] = drupal_render($node->content['model']); $vars['uc_list_price'] = drupal_render($node->content['list_price']); $vars['uc_sell_price'] = drupal_render($node->content['sell_price']); $vars['uc_cost'] = drupal_render($node->content['cost']); $vars['uc_additional'] = drupal_render($node->content); } // Node Theme Settings // Date & author if (!module_exists('submitted_by')) { $date = t('') . format_date($vars['node']->created, 'medium'); // Format date as small, medium, or large $author = theme('username', $vars['node']); $author_only_separator = t(''); $author_date_separator = t(' — '); $submitted_by_content_type = theme_get_setting('submitted_by_enable_content_type') == 1 ? $vars['node']->type : 'default'; $date_setting = theme_get_setting('submitted_by_date_' . $submitted_by_content_type) == 1; $author_setting = theme_get_setting('submitted_by_author_' . $submitted_by_content_type) == 1; $author_separator = $date_setting ? $author_date_separator : $author_only_separator; $date_author = $date_setting ? $date : ''; $date_author .= $author_setting ? $author_separator . $author : ''; $vars['submitted'] = $date_author; } // Taxonomy $taxonomy_content_type = theme_get_setting('taxonomy_enable_content_type') == 1 ? $vars['node']->type : 'default'; $taxonomy_display = theme_get_setting('taxonomy_display_' . $taxonomy_content_type); $taxonomy_format = theme_get_setting('taxonomy_format_' . $taxonomy_content_type); if (module_exists('taxonomy') && ($taxonomy_display == 'all' || $taxonomy_display == 'only' && $vars['page'])) { $vocabularies = taxonomy_get_vocabularies($vars['node']->type); $output = ''; $term_delimiter = ' | '; foreach ($vocabularies as $vocabulary) { if (theme_get_setting('taxonomy_vocab_hide_' . $taxonomy_content_type . '_' . $vocabulary->vid) != 1) { $terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid); if ($terms) { $term_items = ''; foreach ($terms as $term) { // Build vocabulary term items $term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)))); $term_items .= '<li class="vocab-term">' . $term_link . $term_delimiter . '</li>'; } if ($taxonomy_format == 'vocab') { // Add vocabulary labels if separate $output .= '<li class="vocab vocab-' . $vocabulary->vid . '"><span class="vocab-name">' . check_plain($vocabulary->name) . ':</span> <ul class="vocab-list">'; //$output .= '<li class="vocab vocab-'. $vocabulary->vid .'"> <ul class="vocab-list">'; $output .= substr_replace($term_items, '</li>', -(strlen($term_delimiter) + 5)) . '</ul></li>'; } else { $output .= $term_items; } } } } if ($output != '') { $output = $taxonomy_format == 'list' ? substr_replace($output, '</li>', -(strlen($term_delimiter) + 5)) : $output; $output = '<ul class="taxonomy">' . $output . '</ul>'; } $vars['terms'] = $output; } else { $vars['terms'] = ''; } }
function boron_print_terms($node, $vid = NULL, $ordered_list = TRUE) { $vocabularies = taxonomy_get_vocabularies(); if ($ordered_list) { $output .= '<ul>'; } //checks to see if you want an ordered list if ($vid) { //checks to see if you've passed a number with vid, prints just that vid $output = '<div class="tags-' . $vid . '">'; foreach ($vocabularies as $vocabulary) { if ($vocabulary->vid == $vid) { $terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid); if ($terms) { $links = array(); $output .= '<span class="only-vocabulary-' . $vocabulary->vid . '">'; if ($ordered_list) { $output .= '<li class="vocabulary-' . $vocabulary->vid . '">' . $vocabulary->name . ': '; } foreach ($terms as $term) { $links[] = '<span class="term-' . $term->tid . '">' . $term->name . '</span>'; } $output .= implode(', ', $links); if ($ordered_list) { $output .= '</li>'; } $output .= '</span>'; } } } } else { $output = '<div class="tags">'; foreach ($vocabularies as $vocabulary) { if ($vocabularies) { $terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid); if ($terms) { $links = array(); $output .= '<ul class="vocabulary-' . $vocabulary->vid . '">'; if ($ordered_list) { $output .= '<li class="vocabulary-' . $vocabulary->vid . '">' . $vocabulary->name . ': '; } foreach ($terms as $term) { $links[] = '<span class="term-' . $term->tid . '">' . l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description))) . '</span>'; } $output .= implode(', ', $links); if ($ordered_list) { $output .= '</li>'; } $output .= '</ul>'; } } } } if ($ordered_list) { $output .= '</ul>'; } $output .= '</div>'; return $output; }
function ogplcommunities_tagadelic_weighted($terms) { $output = ''; $node = og_get_group_context(); $item = menu_get_item(); foreach ($terms as $term) { switch ($item['path']) { case "node/%/blogs": $output .= l($term->name, "node/{$node->nid}/blogs", array('attributes' => array('class' => "tagadelic level{$term->weight}", 'rel' => 'tag'), 'query' => array('tid' => $term->name))) . " \n"; break; case "node/%/data_tools": $output .= l($term->name, "node/{$node->nid}/data_tools", array('attributes' => array('class' => "tagadelic level{$term->weight}", 'rel' => 'tag'), 'query' => array('tid' => $term->name))) . " \n"; break; default: $output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic level{$term->weight}", 'rel' => 'tag'))) . " \n"; break; } } return $output; }
/** * Override or insert variables into the node templates. * * @param $vars * An array of variables to pass to the theme template. */ function cmssimplicity_preprocess_node(&$vars) { if ($vars['picture']) { $classes = explode(' ', $vars['classes']); $classes[] = 'user-picture'; $vars['classes'] = implode(' ', $classes); } $node = $vars['node']; // override the subbmitted text according to requirment $author = "posted by "; $author .= theme('username', $node); $posted_date = date('F d, Y ', $node->created); $submitted = ''; $submitted_by_content_type = theme_get_setting('submitted_by_content_type') == 1 ? $node->type : 'default'; $author_setting = theme_get_setting('submitted_by_author_' . $submitted_by_content_type) == 1; $date_setting = theme_get_setting('submitted_by_date_' . $submitted_by_content_type) == 1; if ($author_setting) { $submitted = $author . ' '; } if ($date_setting) { $submitted .= $posted_date; } $vars['submitted'] = $submitted; //Formating taxonomy term list according to theme's requirement $taxonomy_content_type = theme_get_setting('taxonomy_enable_content_type') == 1 ? $vars['node']->type : 'default'; $taxonomy_display = theme_get_setting('taxonomy_display_' . $taxonomy_content_type); $taxonomy_format = theme_get_setting('taxonomy_format_' . $taxonomy_content_type); if ($taxonomy_display == 'all' || $taxonomy_display == 'only' && $vars['page']) { $vocabularies = taxonomy_get_vocabularies($vars['node']->type); $vars['terms'] = ''; $term_delimiter = ' // '; foreach ($vocabularies as $vocabulary) { if (theme_get_setting('taxonomy_vocab_hide_' . $taxonomy_content_type . '_' . $vocabulary->vid) != 1) { $terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid); if ($terms) { $term_items = ''; foreach ($terms as $term) { // Build vocabulary term items $term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)))); $term_items .= $term_delimiter . $term_link; } if ($taxonomy_format == 'vocab') { // Add vocabulary labels if separate $vars['terms'] .= '<span class="vocab-name">' . $vocabulary->name . ':</span>'; $vars['terms'] .= $term_items; } else { $vars['terms'] .= $term_items; } } } } if ($vars['terms'] != '') { $vars['terms'] = $vars['terms']; } } }
function MNI_taxonomy_link($node = null) { if ($node != null) { $links = array(); // If previewing, the terms must be converted to objects first. /* if (isset($node->build_mode) && $node->build_mode == NODE_BUILD_PREVIEW) { $node->taxonomy = taxonomy_preview_terms($node); } */ if (!empty($node->taxonomy)) { foreach ($node->taxonomy as $term) { // During preview the free tagging terms are in an array unlike the // other terms which are objects. So we have to check if a $term // is an object or not. if (is_object($term)) { if ($term->vid == 2) { //limit it to mni terms vocabulary $links['taxonomy_term_' . $term->tid] = array('title' => $term->name, 'href' => taxonomy_term_path($term), 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))); } } /* // Previewing free tagging terms; we don't link them because the // term-page might not exist yet. else { foreach ($term as $free_typed) { $typed_terms = drupal_explode_tags($free_typed); foreach ($typed_terms as $typed_term) { $links['taxonomy_preview_term_'. $typed_term] = array( 'title' => $typed_term, ); } } } */ } } // We call this hook again because some modules and themes // call taxonomy_link('taxonomy terms') directly. drupal_alter('link', $links, $node); return $links; } }
/** * Override or insert PHPTemplate variables into the node template. */ function majalahversi_preprocess_node(&$vars) { $node = $vars['node']; if ($node->type != 'page') { $vars['date'] = format_date($node->created, 'custom', 'j M Y'); } else { $vars['date'] = ''; } // If we have any terms... if ($node->taxonomy) { // Let's iterate through each term. foreach ($node->taxonomy as $term) { // We will build a new array where there will be as many // nested arrays as there are vocabularies // The key for each nested array is the vocabulary ID. $vocabulary[$term->vid]['taxonomy_term_' . $term->tid] = array('title' => $term->name, 'href' => taxonomy_term_path($term), 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))); } switch ($node->type) { case 'artikel': $vocab = $vocabulary[4]; break; case 'makassar': $vocab = $vocabulary[19]; break; case 'keliling': $vocab = $vocabulary[21]; break; case 'perusahaan': $vocab = $vocabulary[18]; break; case 'lowongan': $vocab = $vocabulary[26]; break; case 'agenda': $vocab = $vocabulary[9]; break; case 'iklan': $vocab = $vocabulary[10]; break; case 'galeri': $vocab = $vocabulary[16]; break; case 'karikatur': $vocab = $vocabulary[25]; break; case 'kontributor': $vocab = $vocabulary[14]; break; case 'layananpublik': $vocab = $vocabulary[24]; break; case 'regulasi': $vocab = $vocabulary[23]; break; default: $vocab = $vocabulary[4]; break; } $vars['tags'] = theme('links', $vocabulary[15], array('class' => 'links inline')); $vars['categories'] = theme('links', $vocab, array('class' => 'links inline')); $vars['terms'] = $vars['categories']; } if ($node->field_penulis) { foreach ($node->field_penulis as $author) { $vars['authors'] = $author['view']; } } if ($node->type == 'kontributor' && $node->taxonomy) { foreach ($node->taxonomy as $k => $value) { $k = $k; switch ($k) { case '43': $kontribusi = 'Kolom'; break; case '44': $kontribusi = 'Karikatur'; break; default: $kontribusi = 'Artikel'; break; } $vars['kontribusi'] = $kontribusi; } } // we like to display teasers on the node view pages in a different style, // but only if they were NOT set to "show summary on full view" (which seems // backward, but the implication with that checkbox is that the teaser is // PART of the node's body, instead of an actual summary of the entire // node's body). if a node's unbuilt body starts with <!--break-->, then // a teaser has been manually set, and "show summary" is not checked. if ($vars['page'] == TRUE) { // only do this on full page views. $node = node_load($vars['nid']); // we reload the node because // by the time it gets here <!--break--> has already been filtered out. // this if logic stolen from node.module's node_teaser_include_verify(). if (strpos($node->body, '<!--break-->') === 0) { $vars['style_teaser_differently'] = TRUE; $vars['teaser'] = check_markup($node->teaser, $node->format, FALSE); } } }
function KeyTheme_preprocess_node(&$vars) { // If we have any terms... if ($vars['node']->taxonomy) { // Let's iterate through each term. foreach ($vars['node']->taxonomy as $term) { // We will build a new array where there will be as many // nested arrays as there are vocabularies // The key for each nested array is the vocabulary ID. $vocabulary[$term->vid]['taxonomy_term_' . $term->tid] = array('title' => $term->name, 'href' => taxonomy_term_path($term), 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))); } $vars['vocab1'] = theme('links', $vocabulary[1], array('class' => 'links inline')); $vars['vocab2'] = theme('links', $vocabulary[2], array('class' => 'links inline')); $vars['vocab3'] = theme('links', $vocabulary[3], array('class' => 'links inline')); } }