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

Contents of /contributions/modules/node_type_filter/node_type_filter.module

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


Revision 1.2 - (show annotations) (download) (as text)
Wed Mar 9 13:01:34 2005 UTC (4 years, 8 months ago) by weitzman
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-4-6
Changes since 1.1: +1 -1 lines
File MIME type: text/x-php
Lets you filter node listing pages simply by &type=story,blog to the URL (for example)
1 <?php
2 // $Id$
3 /**
4 * @file
5 * Lets you filter node listing pages simply by &type=story,blog to the URL (for example)
6 */
7
8 /**
9 * Implementation of hook_help().
10 */
11 function node_type_filter_help($section) {
12 switch ($section) {
13 case 'admin/modules#description':
14 return t('filters node listings by type');
15 }
16 }
17
18 /**
19 * Implementation of hook_db_rewrite_sql().
20 */
21 function node_type_filter_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
22 if ($primary_field == 'nid') {
23 if ($str_types = $_REQUEST['type']) {
24 $types = explode(',', $str_types);
25 foreach ($types as $type) {
26 $ctypes[] = db_escape_string($type);
27 }
28 $return['where'] = 'n.type IN (\'' . implode("','", $ctypes). '\')';
29 return $return;
30 }
31 }
32 }
33
34 ?>

  ViewVC Help
Powered by ViewVC 1.1.2