/[drupal]/contributions/modules/taxonomy_filter/taxonomy_filter.base.inc
ViewVC logotype

Contents of /contributions/modules/taxonomy_filter/taxonomy_filter.base.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Tue Apr 28 23:39:57 2009 UTC (7 months ago) by solotandem
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, DRUPAL-6--1-1, HEAD
Changes since 1.1: +2 -1 lines
File MIME type: text/x-php
#447896: Change base menu template to display a refine search block and show the current search criteria
1 <?php
2 // $Id: taxonomy_filter.base.inc,v 1.1 2008/07/13 22:52:33 styro Exp $
3
4 /**
5 * @file
6 * A built-in basic template module for the Taxonomy Filter module.
7 *
8 * This is an include rather than a separate module so it can't be
9 * disabled separately from the core module.
10 */
11
12 /**
13 * Implementation of hook_tf_template_info().
14 */
15 function taxonomy_filter_tf_template_info() {
16 return array(
17 'name' => 'base',
18 'desc' => 'The built in basic menu template that is always available.',
19 );
20 }
21
22 /**
23 * Implementation of hook_tf_item_alter().
24 */
25 function taxonomy_filter_tf_item_alter(&$item, $section_info, $block_info, $context = NULL) {
26 if ($context != 'base terms') {
27 if (in_array($item['info']['item_tid'], $block_info['url_tids'])) {
28 $item['link_attributes']['class'][] = 'selected';
29 }
30 }
31 }
32
33 /**
34 * Implementation of hook_tf_link_tids_alter().
35 */
36 function taxonomy_filter_tf_link_tids_alter(&$link_tids, $item_tid, $context) {
37 if ($context == 'base terms') {
38 $link_tids = array($item_tid);
39 }
40 }
41
42 /**
43 * Implementation of hook_tf_block_alter().
44 */
45 function taxonomy_filter_tf_block_alter(&$block) {
46 return; // TODO Re-enable this code?
47 // Note: count results don't turn up here yet because there is no default count
48 // settings for nontemplate blocks
49 $tids = $block['info']['url_tids'];
50 $section_info = array('link_depth' => 'all'); // TODO - count results aren't added because there are no default section settings.
51 if (count($tids) > 1) {
52 // Only add the base terms section to listings of more than one term
53 $terms = array();
54 foreach ($tids as $tid) {
55 $terms[] = taxonomy_get_term($tid);
56 }
57 $items = taxonomy_filter_section_items($terms, $section_info, $block['info'], 'base terms');
58 $new_section = array(
59 'title' => t('Only topics tagged with:'),
60 'items' => $items,
61 );
62 drupal_alter('tf_section', $new_section, $block['info']);
63 $block['sections']['base_terms'] = $new_section;
64 }
65 }

  ViewVC Help
Powered by ViewVC 1.1.2