1 | <?php |
---|
2 | /** |
---|
3 | * @file |
---|
4 | * Contains default views on behalf of the search module. |
---|
5 | */ |
---|
6 | |
---|
7 | /** |
---|
8 | * Implementation of hook_views_default_views(). |
---|
9 | */ |
---|
10 | function search_views_default_views() { |
---|
11 | $view = new view; |
---|
12 | $view->name = 'backlinks'; |
---|
13 | $view->description = 'Displays a list of nodes that link to the node, using the search backlinks table.'; |
---|
14 | $view->tag = 'default'; |
---|
15 | $view->base_table = 'node'; |
---|
16 | $view->human_name = 'Backlinks'; |
---|
17 | $view->api_version = 2; |
---|
18 | $view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */ |
---|
19 | $handler = $view->new_display('default', 'Defaults', 'default'); |
---|
20 | $handler->override_option('fields', array( |
---|
21 | 'title' => array( |
---|
22 | 'id' => 'title', |
---|
23 | 'table' => 'node', |
---|
24 | 'field' => 'title', |
---|
25 | 'label' => '', |
---|
26 | 'relationship' => 'none', |
---|
27 | 'link_to_node' => 1, |
---|
28 | ), |
---|
29 | )); |
---|
30 | $handler->override_option('arguments', array( |
---|
31 | 'nid' => array( |
---|
32 | 'id' => 'nid', |
---|
33 | 'table' => 'search_node_links_to', |
---|
34 | 'field' => 'nid', |
---|
35 | 'default_action' => 'not found', |
---|
36 | 'style_plugin' => 'default_summary', |
---|
37 | 'style_options' => array( |
---|
38 | 'count' => TRUE, |
---|
39 | 'override' => FALSE, |
---|
40 | 'items_per_page' => 25, |
---|
41 | ), |
---|
42 | 'wildcard' => '', |
---|
43 | 'wildcard_substitution' => '', |
---|
44 | 'title' => 'Pages that link to %1', |
---|
45 | 'default_argument_type' => 'fixed', |
---|
46 | 'default_argument' => '', |
---|
47 | 'validate_type' => 'node', |
---|
48 | 'validate_fail' => 'not found', |
---|
49 | 'relationship' => 'none', |
---|
50 | 'default_argument_fixed' => '', |
---|
51 | 'default_argument_php' => '', |
---|
52 | 'validate_argument_node_type' => array(), |
---|
53 | 'validate_argument_php' => '', |
---|
54 | ), |
---|
55 | )); |
---|
56 | $handler->override_option('filters', array( |
---|
57 | 'status' => array( |
---|
58 | 'id' => 'status', |
---|
59 | 'table' => 'node', |
---|
60 | 'field' => 'status', |
---|
61 | 'operator' => '=', |
---|
62 | 'value' => 1, |
---|
63 | 'group' => 0, |
---|
64 | 'exposed' => FALSE, |
---|
65 | 'expose' => array( |
---|
66 | 'operator' => FALSE, |
---|
67 | 'label' => '', |
---|
68 | ), |
---|
69 | 'relationship' => 'none', |
---|
70 | ), |
---|
71 | )); |
---|
72 | $handler->override_option('access', array( |
---|
73 | 'type' => 'perm', |
---|
74 | 'role' => array(), |
---|
75 | 'perm' => 'access content', |
---|
76 | )); |
---|
77 | $handler->override_option('empty', 'No backlinks found.'); |
---|
78 | $handler->override_option('empty_format', '1'); |
---|
79 | $handler->override_option('items_per_page', 30); |
---|
80 | $handler->override_option('use_pager', '1'); |
---|
81 | $handler->override_option('style_plugin', 'list'); |
---|
82 | $handler->override_option('style_options', array( |
---|
83 | 'type' => 'ol', |
---|
84 | )); |
---|
85 | $handler = $view->new_display('page', 'Page', 'page'); |
---|
86 | $handler->override_option('path', 'node/%/backlinks'); |
---|
87 | $handler->override_option('menu', array( |
---|
88 | 'type' => 'tab', |
---|
89 | 'title' => 'What links here', |
---|
90 | 'weight' => '0', |
---|
91 | )); |
---|
92 | $handler->override_option('tab_options', array( |
---|
93 | 'type' => 'none', |
---|
94 | 'title' => '', |
---|
95 | 'weight' => 0, |
---|
96 | )); |
---|
97 | $handler = $view->new_display('block', 'What links here', 'block'); |
---|
98 | $handler->override_option('arguments', array( |
---|
99 | 'nid' => array( |
---|
100 | 'id' => 'nid', |
---|
101 | 'table' => 'search_node_links_to', |
---|
102 | 'field' => 'nid', |
---|
103 | 'default_action' => 'default', |
---|
104 | 'style_plugin' => 'default_summary', |
---|
105 | 'style_options' => array( |
---|
106 | 'count' => TRUE, |
---|
107 | 'override' => FALSE, |
---|
108 | 'items_per_page' => 25, |
---|
109 | ), |
---|
110 | 'wildcard' => '', |
---|
111 | 'wildcard_substitution' => '', |
---|
112 | 'title' => 'What links here', |
---|
113 | 'default_argument_type' => 'node', |
---|
114 | 'default_argument' => '', |
---|
115 | 'validate_type' => 'node', |
---|
116 | 'validate_fail' => 'not found', |
---|
117 | 'relationship' => 'none', |
---|
118 | 'default_argument_fixed' => '', |
---|
119 | 'default_argument_php' => 'return ($node = menu_get_object()) ? $node->nid : FALSE;', |
---|
120 | 'validate_argument_node_type' => array( |
---|
121 | 'album' => 0, |
---|
122 | 'artist' => 0, |
---|
123 | 'book' => 0, |
---|
124 | 'page' => 0, |
---|
125 | 'story' => 0, |
---|
126 | 'track' => 0, |
---|
127 | ), |
---|
128 | 'validate_argument_php' => '', |
---|
129 | 'default_argument_user' => 0, |
---|
130 | 'validate_argument_vocabulary' => array( |
---|
131 | '3' => 0, |
---|
132 | '4' => 0, |
---|
133 | '1' => 0, |
---|
134 | '5' => 0, |
---|
135 | '2' => 0, |
---|
136 | ), |
---|
137 | 'validate_argument_type' => 'tid', |
---|
138 | ), |
---|
139 | )); |
---|
140 | $handler->override_option('items_per_page', 6); |
---|
141 | $handler->override_option('use_more', 1); |
---|
142 | $handler->override_option('style_plugin', 'list'); |
---|
143 | $handler->override_option('style_options', array( |
---|
144 | 'type' => 'ul', |
---|
145 | )); |
---|
146 | $views[$view->name] = $view; |
---|
147 | |
---|
148 | return $views; |
---|
149 | } |
---|