/[drupal]/contributions/modules/views/modules/book.views_convert.inc
ViewVC logotype

Contents of /contributions/modules/views/modules/book.views_convert.inc

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


Revision 1.3 - (show annotations) (download) (as text)
Tue Jun 30 19:14:27 2009 UTC (4 months, 4 weeks ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-7--3
Changes since 1.2: +1 -2 lines
File MIME type: text/x-php
More Views convert updates from Darren Oh
1 <?php
2 // $Id: book.views_convert.inc,v 1.2 2009/06/02 20:31:00 merlinofchaos Exp $
3
4 /**
5 * @file
6 * Field conversion for fields handled by this module.
7 */
8
9 /**
10 * Implementation of hook_views_convert().
11 */
12 function book_views_convert($display, $type, &$view, $field, $id = NULL) {
13 switch ($type) {
14 case 'field':
15 switch ($field['tablename']) {
16 case 'book_parent_node':
17 switch ($field['field']) {
18 case 'title':
19 $item = $view->get_item($display, 'field', $id);
20 if ($field['handler'] == 'views_handler_field_book_parent_title') {
21 $item['link_to_node'] = TRUE;
22 }
23 $item['relationship'] = $view->add_item($display, 'relationship', 'book_parent', 'nid', array(), 'book_parent_nid');
24 $item['table'] = 'node';
25 $item['field'] = 'title';
26 $view->set_item($display, 'field', $id, $item);
27 break;
28 }
29 break;
30 }
31 break;
32 case 'filter':
33 switch ($field['tablename']) {
34 case 'book':
35 switch ($field['field']) {
36 case 'parent':
37 $operators = array('AND' => '=', 'OR' => '=', 'NOT' => '!=');
38 $item = $view->get_item($display, 'filter', $id);
39 $item['operator'] = $operators[$field['operator']];
40 $item['relationship'] = $view->add_item($display, 'relationship', 'book_parent', 'nid', array(), 'book_parent_nid');
41 $item['table'] = 'node';
42 $item['field'] = 'nid';
43 $view->set_item($display, 'filter', $id, $item);
44 break;
45 }
46 break;
47 }
48 break;
49 case 'sort':
50 switch ($field['tablename']) {
51 case 'book':
52 switch ($field['field']) {
53 case 'weight':
54 $view->set_item_option($display, 'sort', $id, 'table', 'book_menu_links');
55 break;
56 }
57 break;
58 case 'book_parent_node':
59 switch ($field['field']) {
60 case 'title':
61 $item = $view->get_item($display, 'sort', $id);
62 $item['relationship'] = $view->add_item($display, 'relationship', 'book_parent', 'nid', array(), 'book_parent_nid');
63 $item['table'] = 'node';
64 $item['field'] = 'title';
65 $view->set_item($display, 'sort', $id, $item);
66 break;
67 }
68 break;
69 }
70 break;
71 case 'argument':
72 $options = $field['argoptions'];
73 switch ($field['type']) {
74 case 'book_parent':
75 $options['relationship'] = $view->add_item($display, 'relationship', 'book_parent', 'nid', array(), 'book_parent_nid');
76 $view->add_item($display, 'argument', 'node', 'nid', $options, $field['id']);
77 break;
78 }
79 break;
80 }
81 }

  ViewVC Help
Powered by ViewVC 1.1.2