/[drupal]/contributions/modules/views/modules/search.views_default.inc
ViewVC logotype

Contents of /contributions/modules/views/modules/search.views_default.inc

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


Revision 1.6 - (show annotations) (download) (as text)
Tue Jun 10 21:30:43 2008 UTC (17 months, 2 weeks ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, DRUPAL-6--2-6, DRUPAL-6--2-5, DRUPAL-6--2-4, DRUPAL-6--2-3, DRUPAL-6--2-2, DRUPAL-6--2-1, DRUPAL-6--2-0, DRUPAL-6--3-0-ALPHA1, DRUPAL-6--2-0-BETA4, DRUPAL-6--2-0-RC5, DRUPAL-6--2-0-RC4, DRUPAL-6--2-0-RC3, DRUPAL-6--2-0-RC1, DRUPAL-6--2-0-RC2, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-6--3, DRUPAL-7--3
Changes since 1.5: +130 -218 lines
File MIME type: text/x-php
Revamped export functionality. This is a less verbose export that takes advantage of the newer options/defaults system so that it does not have to export quite as much data. Also a tool to export multiple views simultaneously.
1 <?php
2 // $Id: search.views_default.inc,v 1.5 2008/05/27 23:49:38 merlinofchaos Exp $
3 /**
4 * @file
5 * Contains default views on behalf of the search module.
6 */
7
8 /**
9 * Implementation of hook_default_view_views().
10 */
11 function search_views_default_views() {
12 $view = new view;
13 $view->name = 'backlinks';
14 $view->description = 'Displays a list of nodes that link to the node, using the search backlinks table.';
15 $view->tag = 'default';
16 $view->view_php = '';
17 $view->base_table = 'node';
18 $view->is_cacheable = '0';
19 $view->api_version = 2;
20 $view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
21 $handler = $view->new_display('default', 'Defaults', 'default');
22 $handler->override_option('fields', array(
23 'title' => array(
24 'id' => 'title',
25 'table' => 'node',
26 'field' => 'title',
27 'label' => '',
28 'relationship' => 'none',
29 'link_to_node' => 1,
30 ),
31 ));
32 $handler->override_option('arguments', array(
33 'nid' => array(
34 'id' => 'nid',
35 'table' => 'search_node_links_to',
36 'field' => 'nid',
37 'default_action' => 'not found',
38 'style_plugin' => 'default_summary',
39 'style_options' => array(
40 'count' => TRUE,
41 'override' => FALSE,
42 'items_per_page' => 25,
43 ),
44 'wildcard' => '',
45 'wildcard_substitution' => '',
46 'title' => 'Pages that link to %1',
47 'default_argument_type' => 'fixed',
48 'default_argument' => '',
49 'validate_type' => 'node',
50 'validate_fail' => 'not found',
51 'relationship' => 'none',
52 'default_argument_fixed' => '',
53 'default_argument_php' => '',
54 'validate_argument_node_type' => array(),
55 'validate_argument_php' => '',
56 ),
57 ));
58 $handler->override_option('filters', array(
59 'status' => array(
60 'id' => 'status',
61 'table' => 'node',
62 'field' => 'status',
63 'operator' => '=',
64 'value' => 1,
65 'group' => 0,
66 'exposed' => FALSE,
67 'expose' => array(
68 'operator' => FALSE,
69 'label' => '',
70 ),
71 'relationship' => 'none',
72 ),
73 ));
74 $handler->override_option('access', array(
75 'type' => 'none',
76 'role' => array(),
77 'perm' => '',
78 ));
79 $handler->override_option('empty', 'No backlinks found.');
80 $handler->override_option('empty_format', '1');
81 $handler->override_option('items_per_page', 30);
82 $handler->override_option('use_pager', '1');
83 $handler->override_option('style_plugin', 'list');
84 $handler->override_option('style_options', array(
85 'type' => 'ol',
86 ));
87 $handler = $view->new_display('page', 'Page', 'page');
88 $handler->override_option('path', 'node/%/backlinks');
89 $handler->override_option('menu', array(
90 'type' => 'tab',
91 'title' => 'What links here',
92 'weight' => '0',
93 ));
94 $handler->override_option('tab_options', array(
95 'type' => 'none',
96 'title' => '',
97 'weight' => 0,
98 ));
99 $handler = $view->new_display('block', 'Block', 'block');
100 $handler->override_option('arguments', array(
101 'nid' => array(
102 'id' => 'nid',
103 'table' => 'search_node_links_to',
104 'field' => 'nid',
105 'default_action' => 'default',
106 'style_plugin' => 'default_summary',
107 'style_options' => array(
108 'count' => TRUE,
109 'override' => FALSE,
110 'items_per_page' => 25,
111 ),
112 'wildcard' => '',
113 'wildcard_substitution' => '',
114 'title' => 'What links here',
115 'default_argument_type' => 'node',
116 'default_argument' => '',
117 'validate_type' => 'node',
118 'validate_fail' => 'not found',
119 'relationship' => 'none',
120 'default_argument_fixed' => '',
121 'default_argument_php' => 'return ($node = menu_get_object()) ? $node->nid : FALSE;',
122 'validate_argument_node_type' => array(
123 'album' => 0,
124 'artist' => 0,
125 'book' => 0,
126 'page' => 0,
127 'story' => 0,
128 'track' => 0,
129 ),
130 'validate_argument_php' => '',
131 'default_argument_user' => 0,
132 'validate_argument_vocabulary' => array(
133 '3' => 0,
134 '4' => 0,
135 '1' => 0,
136 '5' => 0,
137 '2' => 0,
138 ),
139 'validate_argument_type' => 'tid',
140 ),
141 ));
142 $handler->override_option('items_per_page', 6);
143 $handler->override_option('use_more', 1);
144 $handler->override_option('style_plugin', 'list');
145 $handler->override_option('style_options', array(
146 'type' => 'ul',
147 ));
148 $handler->override_option('block_description', 'What links here');
149 $views[$view->name] = $view;
150
151 return $views;
152 }

  ViewVC Help
Powered by ViewVC 1.1.2