/[drupal]/contributions/modules/cck_facets/cck_facets.module
ViewVC logotype

Contents of /contributions/modules/cck_facets/cck_facets.module

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


Revision 1.23 - (show annotations) (download) (as text)
Sun Jan 4 20:06:55 2009 UTC (10 months, 3 weeks ago) by davidlesieur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.22: +4 -4 lines
File MIME type: text/x-php
Updated for API changes in Faceted Search.
1 <?php
2 // $Id: cck_facets.module,v 1.22 2008/09/03 23:06:52 davidlesieur Exp $
3
4 /**
5 * @file
6 * Provides basic functionality for modules that expose CCK fields as facets.
7 */
8
9 /**
10 * Implementation of hook_faceted_search_collect().
11 *
12 * To ensure that all fields are not repeatedly iterated by every CCK facet
13 * module, this implementation of hook_faceted_search_collect() acts as the
14 * master and finds what module to call for each type of field.
15 */
16 function cck_facets_faceted_search_collect(&$facets, $domain, $env, $selection, $arg = NULL) {
17 $fields = content_fields();
18 foreach ($fields as $field) {
19 if (!isset($selection) || isset($selection[$field['field_name']][1])) {
20 $hook = 'cck_facets_collect';
21 foreach (module_implements($hook) as $module) {
22 $function = $module .'_'. $hook;
23 if ($domain == 'text') {
24 $arg = $function($facets, $field, $domain, $env, $arg);
25 }
26 else {
27 $function($facets, $field, $domain, $env, $arg);
28 }
29 }
30 }
31 }
32 if ($domain == 'text') {
33 return $arg;
34 }
35 }
36
37 /**
38 * Return database storage information for the specified field.
39 *
40 * This is needed often, so results are cached.
41 */
42 function _cck_facets_db_info($field) {
43 static $db_info = NULL;
44 if (!isset($db_info[$field['field_name']])) {
45 $db_info[$field['field_name']] = content_database_info($field);
46 }
47 return $db_info[$field['field_name']];
48 }

  ViewVC Help
Powered by ViewVC 1.1.2