@@ -118,66 +118,66 @@ discard block |
||
118 | 118 | parent::options_form($form, $form_state); |
119 | 119 | |
120 | 120 | switch ($form_state['section']) { |
121 | - case 'inherit_arguments': |
|
122 | - $form['#title'] .= t('Inherit arguments'); |
|
123 | - $form['inherit_arguments'] = array( |
|
124 | - '#type' => 'checkbox', |
|
125 | - '#title' => t('Inherit'), |
|
126 | - '#description' => t('Should this display inherit its arguments from the parent display to which it is attached?'), |
|
127 | - '#default_value' => $this->get_option('inherit_arguments'), |
|
128 | - ); |
|
129 | - break; |
|
130 | - case 'inherit_exposed_filters': |
|
131 | - $form['#title'] .= t('Inherit exposed filters'); |
|
132 | - $form['inherit_exposed_filters'] = array( |
|
133 | - '#type' => 'checkbox', |
|
134 | - '#title' => t('Inherit'), |
|
135 | - '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'), |
|
136 | - '#default_value' => $this->get_option('inherit_exposed_filters'), |
|
137 | - ); |
|
138 | - break; |
|
139 | - case 'inherit_pager': |
|
140 | - $form['#title'] .= t('Inherit pager'); |
|
141 | - $form['inherit_pager'] = array( |
|
142 | - '#type' => 'checkbox', |
|
143 | - '#title' => t('Inherit'), |
|
144 | - '#description' => t('Should this display inherit its paging values from the parent display to which it is attached? Note that this will provide unexpected results if the number of items to display do not match.'), |
|
145 | - '#default_value' => $this->get_option('inherit_pager'), |
|
146 | - ); |
|
147 | - break; |
|
148 | - case 'render_pager': |
|
149 | - $form['#title'] .= t('Render pager'); |
|
150 | - $form['render_pager'] = array( |
|
151 | - '#type' => 'checkbox', |
|
152 | - '#title' => t('Render'), |
|
153 | - '#description' => t('Should this display render the pager values? If not it can inherit from the parent...'), |
|
154 | - '#default_value' => $this->get_option('render_pager'), |
|
155 | - ); |
|
156 | - break; |
|
157 | - case 'attachment_position': |
|
158 | - $form['#title'] .= t('Position'); |
|
159 | - $form['attachment_position'] = array( |
|
160 | - '#type' => 'radios', |
|
161 | - '#description' => t('Attach before or after the parent display?'), |
|
162 | - '#options' => $this->attachment_positions(), |
|
163 | - '#default_value' => $this->get_option('attachment_position'), |
|
164 | - ); |
|
165 | - break; |
|
166 | - case 'displays': |
|
167 | - $form['#title'] .= t('Attach to'); |
|
168 | - $displays = array(); |
|
169 | - foreach ($this->view->display as $display_id => $display) { |
|
170 | - if (!empty($display->handler) && $display->handler->accept_attachments()) { |
|
171 | - $displays[$display_id] = $display->display_title; |
|
172 | - } |
|
121 | + case 'inherit_arguments': |
|
122 | + $form['#title'] .= t('Inherit arguments'); |
|
123 | + $form['inherit_arguments'] = array( |
|
124 | + '#type' => 'checkbox', |
|
125 | + '#title' => t('Inherit'), |
|
126 | + '#description' => t('Should this display inherit its arguments from the parent display to which it is attached?'), |
|
127 | + '#default_value' => $this->get_option('inherit_arguments'), |
|
128 | + ); |
|
129 | + break; |
|
130 | + case 'inherit_exposed_filters': |
|
131 | + $form['#title'] .= t('Inherit exposed filters'); |
|
132 | + $form['inherit_exposed_filters'] = array( |
|
133 | + '#type' => 'checkbox', |
|
134 | + '#title' => t('Inherit'), |
|
135 | + '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'), |
|
136 | + '#default_value' => $this->get_option('inherit_exposed_filters'), |
|
137 | + ); |
|
138 | + break; |
|
139 | + case 'inherit_pager': |
|
140 | + $form['#title'] .= t('Inherit pager'); |
|
141 | + $form['inherit_pager'] = array( |
|
142 | + '#type' => 'checkbox', |
|
143 | + '#title' => t('Inherit'), |
|
144 | + '#description' => t('Should this display inherit its paging values from the parent display to which it is attached? Note that this will provide unexpected results if the number of items to display do not match.'), |
|
145 | + '#default_value' => $this->get_option('inherit_pager'), |
|
146 | + ); |
|
147 | + break; |
|
148 | + case 'render_pager': |
|
149 | + $form['#title'] .= t('Render pager'); |
|
150 | + $form['render_pager'] = array( |
|
151 | + '#type' => 'checkbox', |
|
152 | + '#title' => t('Render'), |
|
153 | + '#description' => t('Should this display render the pager values? If not it can inherit from the parent...'), |
|
154 | + '#default_value' => $this->get_option('render_pager'), |
|
155 | + ); |
|
156 | + break; |
|
157 | + case 'attachment_position': |
|
158 | + $form['#title'] .= t('Position'); |
|
159 | + $form['attachment_position'] = array( |
|
160 | + '#type' => 'radios', |
|
161 | + '#description' => t('Attach before or after the parent display?'), |
|
162 | + '#options' => $this->attachment_positions(), |
|
163 | + '#default_value' => $this->get_option('attachment_position'), |
|
164 | + ); |
|
165 | + break; |
|
166 | + case 'displays': |
|
167 | + $form['#title'] .= t('Attach to'); |
|
168 | + $displays = array(); |
|
169 | + foreach ($this->view->display as $display_id => $display) { |
|
170 | + if (!empty($display->handler) && $display->handler->accept_attachments()) { |
|
171 | + $displays[$display_id] = $display->display_title; |
|
173 | 172 | } |
174 | - $form['displays'] = array( |
|
175 | - '#type' => 'checkboxes', |
|
176 | - '#description' => t('Select which display or displays this should attach to.'), |
|
177 | - '#options' => $displays, |
|
178 | - '#default_value' => $this->get_option('displays'), |
|
179 | - ); |
|
180 | - break; |
|
173 | + } |
|
174 | + $form['displays'] = array( |
|
175 | + '#type' => 'checkboxes', |
|
176 | + '#description' => t('Select which display or displays this should attach to.'), |
|
177 | + '#options' => $displays, |
|
178 | + '#default_value' => $this->get_option('displays'), |
|
179 | + ); |
|
180 | + break; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | // It is very important to call the parent function here: |
190 | 190 | parent::options_submit($form, $form_state); |
191 | 191 | switch ($form_state['section']) { |
192 | - case 'inherit_arguments': |
|
193 | - case 'inherit_pager': |
|
194 | - case 'render_pager': |
|
195 | - case 'inherit_exposed_filters': |
|
196 | - case 'attachment_position': |
|
197 | - case 'displays': |
|
198 | - $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
199 | - break; |
|
192 | + case 'inherit_arguments': |
|
193 | + case 'inherit_pager': |
|
194 | + case 'render_pager': |
|
195 | + case 'inherit_exposed_filters': |
|
196 | + case 'attachment_position': |
|
197 | + case 'displays': |
|
198 | + $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
199 | + break; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | $attachment = $view->execute_display($this->display->id, $args); |
233 | 233 | |
234 | 234 | switch ($this->get_option('attachment_position')) { |
235 | - case 'before': |
|
236 | - $this->view->attachment_before .= $attachment; |
|
237 | - break; |
|
238 | - case 'after': |
|
239 | - $this->view->attachment_after .= $attachment; |
|
240 | - break; |
|
241 | - case 'both': |
|
242 | - $this->view->attachment_before .= $attachment; |
|
243 | - $this->view->attachment_after .= $attachment; |
|
244 | - break; |
|
235 | + case 'before': |
|
236 | + $this->view->attachment_before .= $attachment; |
|
237 | + break; |
|
238 | + case 'after': |
|
239 | + $this->view->attachment_after .= $attachment; |
|
240 | + break; |
|
241 | + case 'both': |
|
242 | + $this->view->attachment_before .= $attachment; |
|
243 | + $this->view->attachment_after .= $attachment; |
|
244 | + break; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | $view->destroy(); |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | parent::options_form($form, $form_state); |
131 | 131 | |
132 | 132 | switch ($form_state['section']) { |
133 | - case 'block_description': |
|
134 | - $form['#title'] .= t('Block admin description'); |
|
135 | - $form['block_description'] = array( |
|
136 | - '#type' => 'textfield', |
|
137 | - '#description' => t('This will appear as the name of this block in administer >> site building >> blocks.'), |
|
138 | - '#default_value' => $this->get_option('block_description'), |
|
139 | - ); |
|
140 | - break; |
|
141 | - case 'block_caching': |
|
142 | - $form['#title'] .= t('Block caching type'); |
|
143 | - |
|
144 | - $form['block_caching'] = array( |
|
145 | - '#type' => 'radios', |
|
146 | - '#description' => t("This sets the default status for Drupal's built-in block caching method; this requires that caching be turned on in block administration, and be careful because you have little control over when this cache is flushed."), |
|
147 | - '#options' => $this->block_caching_modes(), |
|
148 | - '#default_value' => $this->get_cache_type(), |
|
149 | - ); |
|
150 | - break; |
|
133 | + case 'block_description': |
|
134 | + $form['#title'] .= t('Block admin description'); |
|
135 | + $form['block_description'] = array( |
|
136 | + '#type' => 'textfield', |
|
137 | + '#description' => t('This will appear as the name of this block in administer >> site building >> blocks.'), |
|
138 | + '#default_value' => $this->get_option('block_description'), |
|
139 | + ); |
|
140 | + break; |
|
141 | + case 'block_caching': |
|
142 | + $form['#title'] .= t('Block caching type'); |
|
143 | + |
|
144 | + $form['block_caching'] = array( |
|
145 | + '#type' => 'radios', |
|
146 | + '#description' => t("This sets the default status for Drupal's built-in block caching method; this requires that caching be turned on in block administration, and be careful because you have little control over when this cache is flushed."), |
|
147 | + '#options' => $this->block_caching_modes(), |
|
148 | + '#default_value' => $this->get_cache_type(), |
|
149 | + ); |
|
150 | + break; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | // It is very important to call the parent function here: |
160 | 160 | parent::options_submit($form, $form_state); |
161 | 161 | switch ($form_state['section']) { |
162 | - case 'block_description': |
|
163 | - $this->set_option('block_description', $form_state['values']['block_description']); |
|
164 | - break; |
|
165 | - case 'block_caching': |
|
166 | - $this->set_option('block_caching', $form_state['values']['block_caching']); |
|
167 | - $this->save_block_cache($form_state['view']->name.'-'.$form_state['display_id'], $form_state['values']['block_caching']); |
|
168 | - break; |
|
162 | + case 'block_description': |
|
163 | + $this->set_option('block_description', $form_state['values']['block_description']); |
|
164 | + break; |
|
165 | + case 'block_caching': |
|
166 | + $this->set_option('block_caching', $form_state['values']['block_caching']); |
|
167 | + $this->save_block_cache($form_state['view']->name.'-'.$form_state['display_id'], $form_state['values']['block_caching']); |
|
168 | + break; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | switch ($menu['type']) { |
103 | - case 'none': |
|
104 | - default: |
|
105 | - $items[$path]['type'] = MENU_CALLBACK; |
|
106 | - break; |
|
107 | - case 'normal': |
|
108 | - $items[$path]['type'] = MENU_NORMAL_ITEM; |
|
109 | - // Insert item into the proper menu |
|
110 | - $items[$path]['menu_name'] = $menu['name']; |
|
111 | - break; |
|
112 | - case 'tab': |
|
113 | - $items[$path]['type'] = MENU_LOCAL_TASK; |
|
114 | - break; |
|
115 | - case 'default tab': |
|
116 | - $items[$path]['type'] = MENU_DEFAULT_LOCAL_TASK; |
|
117 | - break; |
|
103 | + case 'none': |
|
104 | + default: |
|
105 | + $items[$path]['type'] = MENU_CALLBACK; |
|
106 | + break; |
|
107 | + case 'normal': |
|
108 | + $items[$path]['type'] = MENU_NORMAL_ITEM; |
|
109 | + // Insert item into the proper menu |
|
110 | + $items[$path]['menu_name'] = $menu['name']; |
|
111 | + break; |
|
112 | + case 'tab': |
|
113 | + $items[$path]['type'] = MENU_LOCAL_TASK; |
|
114 | + break; |
|
115 | + case 'default tab': |
|
116 | + $items[$path]['type'] = MENU_DEFAULT_LOCAL_TASK; |
|
117 | + break; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // If this is a 'default' tab, check to see if we have to create teh |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | 'menu_name' => $tab_options['name'], |
145 | 145 | ); |
146 | 146 | switch ($tab_options['type']) { |
147 | - default: |
|
148 | - case 'normal': |
|
149 | - $items[$default_path]['type'] = MENU_NORMAL_ITEM; |
|
150 | - break; |
|
151 | - case 'tab': |
|
152 | - $items[$default_path]['type'] = MENU_LOCAL_TASK; |
|
153 | - break; |
|
147 | + default: |
|
148 | + case 'normal': |
|
149 | + $items[$default_path]['type'] = MENU_NORMAL_ITEM; |
|
150 | + break; |
|
151 | + case 'tab': |
|
152 | + $items[$default_path]['type'] = MENU_LOCAL_TASK; |
|
153 | + break; |
|
154 | 154 | } |
155 | 155 | if (isset($tab_options['weight'])) { |
156 | 156 | $items[$default_path]['weight'] = intval($tab_options['weight']); |
@@ -221,17 +221,17 @@ discard block |
||
221 | 221 | $menu = array('type' => 'none'); |
222 | 222 | } |
223 | 223 | switch($menu['type']) { |
224 | - case 'none': |
|
225 | - default: |
|
226 | - $menu_str = t('No menu'); |
|
227 | - break; |
|
228 | - case 'normal': |
|
229 | - $menu_str = t('Normal: @title', array('@title' => $menu['title'])); |
|
230 | - break; |
|
231 | - case 'tab': |
|
232 | - case 'default tab': |
|
233 | - $menu_str = t('Tab: @title', array('@title' => $menu['title'])); |
|
234 | - break; |
|
224 | + case 'none': |
|
225 | + default: |
|
226 | + $menu_str = t('No menu'); |
|
227 | + break; |
|
228 | + case 'normal': |
|
229 | + $menu_str = t('Normal: @title', array('@title' => $menu['title'])); |
|
230 | + break; |
|
231 | + case 'tab': |
|
232 | + case 'default tab': |
|
233 | + $menu_str = t('Tab: @title', array('@title' => $menu['title'])); |
|
234 | + break; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | if (strlen($menu_str) > 16) { |
@@ -258,176 +258,176 @@ discard block |
||
258 | 258 | parent::options_form($form, $form_state); |
259 | 259 | |
260 | 260 | switch ($form_state['section']) { |
261 | - case 'path': |
|
262 | - $form['#title'] .= t('The menu path or URL of this view'); |
|
263 | - $form['#help_topic'] = 'path'; |
|
264 | - $form['path'] = array( |
|
265 | - '#type' => 'textfield', |
|
266 | - '#description' => t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for arguments: For example, "node/%/feed".'), |
|
267 | - '#default_value' => $this->get_option('path'), |
|
261 | + case 'path': |
|
262 | + $form['#title'] .= t('The menu path or URL of this view'); |
|
263 | + $form['#help_topic'] = 'path'; |
|
264 | + $form['path'] = array( |
|
265 | + '#type' => 'textfield', |
|
266 | + '#description' => t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for arguments: For example, "node/%/feed".'), |
|
267 | + '#default_value' => $this->get_option('path'), |
|
268 | 268 | '#field_prefix' => '<span dir="ltr">' . url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), |
269 | 269 | '#field_suffix' => '</span>‎', |
270 | 270 | '#attributes' => array('dir'=>'ltr'), |
271 | - ); |
|
272 | - break; |
|
273 | - case 'menu': |
|
274 | - $form['#title'] .= t('Menu item entry'); |
|
275 | - $form['#help_topic'] = 'menu'; |
|
276 | - $form['menu'] = array( |
|
277 | - '#prefix' => '<div class="clear-block">', |
|
278 | - '#suffix' => '</div>', |
|
279 | - '#tree' => TRUE, |
|
280 | - ); |
|
281 | - $menu = $this->get_option('menu'); |
|
282 | - if (empty($menu)) { |
|
283 | - $menu = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
284 | - } |
|
285 | - $form['menu']['type'] = array( |
|
286 | - '#prefix' => '<div class="views-left-30">', |
|
287 | - '#suffix' => '</div>', |
|
288 | - '#title' => t('Type'), |
|
289 | - '#type' => 'radios', |
|
290 | - '#options' => array( |
|
291 | - 'none' => t('No menu entry'), |
|
292 | - 'normal' => t('Normal menu entry'), |
|
293 | - 'tab' => t('Menu tab'), |
|
294 | - 'default tab' => t('Default menu tab') |
|
295 | - ), |
|
296 | - '#default_value' => $menu['type'], |
|
297 | - ); |
|
298 | - $form['menu']['title'] = array( |
|
299 | - '#prefix' => '<div class="views-left-50">', |
|
300 | - '#title' => t('Title'), |
|
301 | - '#type' => 'textfield', |
|
302 | - '#default_value' => $menu['title'], |
|
303 | - '#description' => t('If set to normal or tab, enter the text to use for the menu item.'), |
|
304 | - '#process' => array('views_process_dependency'), |
|
305 | - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
306 | - ); |
|
307 | - $form['menu']['description'] = array( |
|
308 | - '#title' => t('Description'), |
|
309 | - '#type' => 'textfield', |
|
310 | - '#default_value' => $menu['description'], |
|
311 | - '#description' => t("If set to normal or tab, enter the text to use for the menu item's description."), |
|
312 | - '#process' => array('views_process_dependency'), |
|
313 | - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
314 | - ); |
|
315 | - $form['menu']['name-warning'] = array( |
|
316 | - '#type' => 'markup', |
|
317 | - '#prefix' => '<div class="warning">', |
|
318 | - '#value' => t("Warning: Changing this item's menu will not work reliably in Drupal 6.4 or earlier. Please upgrade your copy of Drupal at !url.", array('!url' => l('drupal.org', 'http://drupal.org/project/Drupal+project'))), |
|
319 | - '#suffix' => '</div>', |
|
271 | + ); |
|
272 | + break; |
|
273 | + case 'menu': |
|
274 | + $form['#title'] .= t('Menu item entry'); |
|
275 | + $form['#help_topic'] = 'menu'; |
|
276 | + $form['menu'] = array( |
|
277 | + '#prefix' => '<div class="clear-block">', |
|
278 | + '#suffix' => '</div>', |
|
279 | + '#tree' => TRUE, |
|
280 | + ); |
|
281 | + $menu = $this->get_option('menu'); |
|
282 | + if (empty($menu)) { |
|
283 | + $menu = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
284 | + } |
|
285 | + $form['menu']['type'] = array( |
|
286 | + '#prefix' => '<div class="views-left-30">', |
|
287 | + '#suffix' => '</div>', |
|
288 | + '#title' => t('Type'), |
|
289 | + '#type' => 'radios', |
|
290 | + '#options' => array( |
|
291 | + 'none' => t('No menu entry'), |
|
292 | + 'normal' => t('Normal menu entry'), |
|
293 | + 'tab' => t('Menu tab'), |
|
294 | + 'default tab' => t('Default menu tab') |
|
295 | + ), |
|
296 | + '#default_value' => $menu['type'], |
|
297 | + ); |
|
298 | + $form['menu']['title'] = array( |
|
299 | + '#prefix' => '<div class="views-left-50">', |
|
300 | + '#title' => t('Title'), |
|
301 | + '#type' => 'textfield', |
|
302 | + '#default_value' => $menu['title'], |
|
303 | + '#description' => t('If set to normal or tab, enter the text to use for the menu item.'), |
|
304 | + '#process' => array('views_process_dependency'), |
|
305 | + '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
306 | + ); |
|
307 | + $form['menu']['description'] = array( |
|
308 | + '#title' => t('Description'), |
|
309 | + '#type' => 'textfield', |
|
310 | + '#default_value' => $menu['description'], |
|
311 | + '#description' => t("If set to normal or tab, enter the text to use for the menu item's description."), |
|
312 | + '#process' => array('views_process_dependency'), |
|
313 | + '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
314 | + ); |
|
315 | + $form['menu']['name-warning'] = array( |
|
316 | + '#type' => 'markup', |
|
317 | + '#prefix' => '<div class="warning">', |
|
318 | + '#value' => t("Warning: Changing this item's menu will not work reliably in Drupal 6.4 or earlier. Please upgrade your copy of Drupal at !url.", array('!url' => l('drupal.org', 'http://drupal.org/project/Drupal+project'))), |
|
319 | + '#suffix' => '</div>', |
|
320 | + '#process' => array('views_process_dependency'), |
|
321 | + '#dependency' => array('radio:menu[type]' => array('normal')), |
|
322 | + '#access' => version_compare(VERSION, '6.5', '<'), |
|
323 | + ); |
|
324 | + |
|
325 | + // Only display the menu selector if menu module is enabled. |
|
326 | + if (module_exists('menu')) { |
|
327 | + $form['menu']['name'] = array( |
|
328 | + '#title' => t('Menu'), |
|
329 | + '#type' => 'select', |
|
330 | + '#options' => menu_get_menus(), |
|
331 | + '#default_value' => $menu['name'], |
|
332 | + '#description' => t('Insert item into an available menu.'), // |
|
320 | 333 | '#process' => array('views_process_dependency'), |
321 | 334 | '#dependency' => array('radio:menu[type]' => array('normal')), |
322 | - '#access' => version_compare(VERSION, '6.5', '<'), |
|
323 | 335 | ); |
324 | - |
|
325 | - // Only display the menu selector if menu module is enabled. |
|
326 | - if (module_exists('menu')) { |
|
327 | - $form['menu']['name'] = array( |
|
328 | - '#title' => t('Menu'), |
|
329 | - '#type' => 'select', |
|
330 | - '#options' => menu_get_menus(), |
|
331 | - '#default_value' => $menu['name'], |
|
332 | - '#description' => t('Insert item into an available menu.'), // |
|
333 | - '#process' => array('views_process_dependency'), |
|
334 | - '#dependency' => array('radio:menu[type]' => array('normal')), |
|
335 | - ); |
|
336 | - } |
|
337 | - else { |
|
338 | - $form['menu']['name'] = array( |
|
339 | - '#type' => 'value', |
|
340 | - '#value' => $menu['name'], |
|
341 | - ); |
|
342 | - $form['menu']['markup'] = array( |
|
343 | - '#value' => t('Menu selection requires the activation of menu module.'), |
|
344 | - ); |
|
345 | - } |
|
346 | - $form['menu']['weight'] = array( |
|
347 | - '#suffix' => '</div>', |
|
348 | - '#title' => t('Weight'), |
|
349 | - '#type' => 'textfield', |
|
350 | - '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0, |
|
351 | - '#description' => t('The lower the weight the higher/further left it will appear.'), |
|
352 | - '#process' => array('views_process_dependency'), |
|
353 | - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
336 | + } |
|
337 | + else { |
|
338 | + $form['menu']['name'] = array( |
|
339 | + '#type' => 'value', |
|
340 | + '#value' => $menu['name'], |
|
354 | 341 | ); |
355 | - break; |
|
356 | - case 'tab_options': |
|
357 | - $form['#title'] .= t('Default tab options'); |
|
358 | - $tab_options = $this->get_option('tab_options'); |
|
359 | - if (empty($tab_options)) { |
|
360 | - $tab_options = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
361 | - } |
|
362 | - |
|
363 | - $form['tab_markup'] = array( |
|
364 | - '#prefix' => '<div class="form-item description">', |
|
365 | - '#suffix' => '</div>', |
|
366 | - '#value' => t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is <em>foo/bar/baz</em>, the parent path would be <em>foo/bar</em>.'), |
|
342 | + $form['menu']['markup'] = array( |
|
343 | + '#value' => t('Menu selection requires the activation of menu module.'), |
|
367 | 344 | ); |
345 | + } |
|
346 | + $form['menu']['weight'] = array( |
|
347 | + '#suffix' => '</div>', |
|
348 | + '#title' => t('Weight'), |
|
349 | + '#type' => 'textfield', |
|
350 | + '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0, |
|
351 | + '#description' => t('The lower the weight the higher/further left it will appear.'), |
|
352 | + '#process' => array('views_process_dependency'), |
|
353 | + '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
354 | + ); |
|
355 | + break; |
|
356 | + case 'tab_options': |
|
357 | + $form['#title'] .= t('Default tab options'); |
|
358 | + $tab_options = $this->get_option('tab_options'); |
|
359 | + if (empty($tab_options)) { |
|
360 | + $tab_options = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
361 | + } |
|
368 | 362 | |
369 | - $form['tab_options'] = array( |
|
370 | - '#prefix' => '<div class="clear-block">', |
|
371 | - '#suffix' => '</div>', |
|
372 | - '#tree' => TRUE, |
|
373 | - ); |
|
374 | - $form['tab_options']['type'] = array( |
|
375 | - '#prefix' => '<div class="views-left-25">', |
|
376 | - '#suffix' => '</div>', |
|
377 | - '#title' => t('Parent menu item'), |
|
378 | - '#type' => 'radios', |
|
379 | - '#options' => array('none' => t('Already exists'), 'normal' => t('Normal menu item'), 'tab' => t('Menu tab')), |
|
380 | - '#default_value' => $tab_options['type'], |
|
381 | - ); |
|
382 | - $form['tab_options']['title'] = array( |
|
383 | - '#prefix' => '<div class="views-left-75">', |
|
384 | - '#title' => t('Title'), |
|
385 | - '#type' => 'textfield', |
|
386 | - '#default_value' => $tab_options['title'], |
|
387 | - '#description' => t('If creating a parent menu item, enter the title of the item.'), |
|
363 | + $form['tab_markup'] = array( |
|
364 | + '#prefix' => '<div class="form-item description">', |
|
365 | + '#suffix' => '</div>', |
|
366 | + '#value' => t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is <em>foo/bar/baz</em>, the parent path would be <em>foo/bar</em>.'), |
|
367 | + ); |
|
368 | + |
|
369 | + $form['tab_options'] = array( |
|
370 | + '#prefix' => '<div class="clear-block">', |
|
371 | + '#suffix' => '</div>', |
|
372 | + '#tree' => TRUE, |
|
373 | + ); |
|
374 | + $form['tab_options']['type'] = array( |
|
375 | + '#prefix' => '<div class="views-left-25">', |
|
376 | + '#suffix' => '</div>', |
|
377 | + '#title' => t('Parent menu item'), |
|
378 | + '#type' => 'radios', |
|
379 | + '#options' => array('none' => t('Already exists'), 'normal' => t('Normal menu item'), 'tab' => t('Menu tab')), |
|
380 | + '#default_value' => $tab_options['type'], |
|
381 | + ); |
|
382 | + $form['tab_options']['title'] = array( |
|
383 | + '#prefix' => '<div class="views-left-75">', |
|
384 | + '#title' => t('Title'), |
|
385 | + '#type' => 'textfield', |
|
386 | + '#default_value' => $tab_options['title'], |
|
387 | + '#description' => t('If creating a parent menu item, enter the title of the item.'), |
|
388 | + '#process' => array('views_process_dependency'), |
|
389 | + '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
390 | + ); |
|
391 | + $form['tab_options']['description'] = array( |
|
392 | + '#title' => t('Description'), |
|
393 | + '#type' => 'textfield', |
|
394 | + '#default_value' => $tab_options['description'], |
|
395 | + '#description' => t('If creating a parent menu item, enter the description of the item.'), |
|
396 | + '#process' => array('views_process_dependency'), |
|
397 | + '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
398 | + ); |
|
399 | + // Only display the menu selector if menu module is enabled. |
|
400 | + if (module_exists('menu')) { |
|
401 | + $form['tab_options']['name'] = array( |
|
402 | + '#title' => t('Menu'), |
|
403 | + '#type' => 'select', |
|
404 | + '#options' => menu_get_menus(), |
|
405 | + '#default_value' => $tab_options['name'], |
|
406 | + '#description' => t('Insert item into an available menu.'), |
|
388 | 407 | '#process' => array('views_process_dependency'), |
389 | - '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
408 | + '#dependency' => array('radio:tab_options[type]' => array('normal')), |
|
390 | 409 | ); |
391 | - $form['tab_options']['description'] = array( |
|
392 | - '#title' => t('Description'), |
|
393 | - '#type' => 'textfield', |
|
394 | - '#default_value' => $tab_options['description'], |
|
395 | - '#description' => t('If creating a parent menu item, enter the description of the item.'), |
|
396 | - '#process' => array('views_process_dependency'), |
|
397 | - '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
410 | + } |
|
411 | + else { |
|
412 | + $form['tab_options']['name'] = array( |
|
413 | + '#type' => 'value', |
|
414 | + '#value' => $tab_options['name'], |
|
398 | 415 | ); |
399 | - // Only display the menu selector if menu module is enabled. |
|
400 | - if (module_exists('menu')) { |
|
401 | - $form['tab_options']['name'] = array( |
|
402 | - '#title' => t('Menu'), |
|
403 | - '#type' => 'select', |
|
404 | - '#options' => menu_get_menus(), |
|
405 | - '#default_value' => $tab_options['name'], |
|
406 | - '#description' => t('Insert item into an available menu.'), |
|
407 | - '#process' => array('views_process_dependency'), |
|
408 | - '#dependency' => array('radio:tab_options[type]' => array('normal')), |
|
409 | - ); |
|
410 | - } |
|
411 | - else { |
|
412 | - $form['tab_options']['name'] = array( |
|
413 | - '#type' => 'value', |
|
414 | - '#value' => $tab_options['name'], |
|
415 | - ); |
|
416 | - $form['tab_options']['markup'] = array( |
|
417 | - '#value' => t('Menu selection requires the activation of menu module.'), |
|
418 | - ); |
|
419 | - } |
|
420 | - $form['tab_options']['weight'] = array( |
|
421 | - '#suffix' => '</div>', |
|
422 | - '#title' => t('Tab weight'), |
|
423 | - '#type' => 'textfield', |
|
424 | - '#default_value' => $tab_options['weight'], |
|
425 | - '#size' => 5, |
|
426 | - '#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'), |
|
427 | - '#process' => array('views_process_dependency'), |
|
428 | - '#dependency' => array('radio:tab_options[type]' => array('tab')), |
|
416 | + $form['tab_options']['markup'] = array( |
|
417 | + '#value' => t('Menu selection requires the activation of menu module.'), |
|
429 | 418 | ); |
430 | - break; |
|
419 | + } |
|
420 | + $form['tab_options']['weight'] = array( |
|
421 | + '#suffix' => '</div>', |
|
422 | + '#title' => t('Tab weight'), |
|
423 | + '#type' => 'textfield', |
|
424 | + '#default_value' => $tab_options['weight'], |
|
425 | + '#size' => 5, |
|
426 | + '#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'), |
|
427 | + '#process' => array('views_process_dependency'), |
|
428 | + '#dependency' => array('radio:tab_options[type]' => array('tab')), |
|
429 | + ); |
|
430 | + break; |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
@@ -435,37 +435,37 @@ discard block |
||
435 | 435 | // It is very important to call the parent function here: |
436 | 436 | parent::options_validate($form, $form_state); |
437 | 437 | switch ($form_state['section']) { |
438 | - case 'path': |
|
439 | - if (strpos($form_state['values']['path'], '$arg') !== FALSE) { |
|
440 | - form_error($form['path'], t('"$arg" is no longer supported. Use % instead.')); |
|
441 | - } |
|
438 | + case 'path': |
|
439 | + if (strpos($form_state['values']['path'], '$arg') !== FALSE) { |
|
440 | + form_error($form['path'], t('"$arg" is no longer supported. Use % instead.')); |
|
441 | + } |
|
442 | 442 | |
443 | - if (strpos($form_state['values']['path'], '%') === 0) { |
|
444 | - form_error($form['path'], t('"%" may not be used for the first segment of a path.')); |
|
445 | - } |
|
443 | + if (strpos($form_state['values']['path'], '%') === 0) { |
|
444 | + form_error($form['path'], t('"%" may not be used for the first segment of a path.')); |
|
445 | + } |
|
446 | 446 | |
447 | - // automatically remove '/' from path. |
|
448 | - $form_state['values']['path'] = trim($form_state['values']['path'], '/'); |
|
447 | + // automatically remove '/' from path. |
|
448 | + $form_state['values']['path'] = trim($form_state['values']['path'], '/'); |
|
449 | 449 | |
450 | - break; |
|
451 | - case 'menu': |
|
452 | - $path = $this->get_option('path'); |
|
453 | - if ($form_state['values']['menu']['type'] == 'normal' && strpos($path, '%') !== FALSE) { |
|
454 | - form_error($form['menu']['type'], t('Views cannot create normal menu items for paths with a % in them.')); |
|
455 | - } |
|
450 | + break; |
|
451 | + case 'menu': |
|
452 | + $path = $this->get_option('path'); |
|
453 | + if ($form_state['values']['menu']['type'] == 'normal' && strpos($path, '%') !== FALSE) { |
|
454 | + form_error($form['menu']['type'], t('Views cannot create normal menu items for paths with a % in them.')); |
|
455 | + } |
|
456 | 456 | |
457 | - if ($form_state['values']['menu']['type'] == 'default tab' || $form_state['values']['menu']['type'] == 'tab') { |
|
458 | - $bits = explode('/', $path); |
|
459 | - $last = array_pop($bits); |
|
460 | - if ($last == '%') { |
|
461 | - form_error($form['menu']['type'], t('A display whose path ends with a % cannot be a tab.')); |
|
462 | - } |
|
457 | + if ($form_state['values']['menu']['type'] == 'default tab' || $form_state['values']['menu']['type'] == 'tab') { |
|
458 | + $bits = explode('/', $path); |
|
459 | + $last = array_pop($bits); |
|
460 | + if ($last == '%') { |
|
461 | + form_error($form['menu']['type'], t('A display whose path ends with a % cannot be a tab.')); |
|
463 | 462 | } |
463 | + } |
|
464 | 464 | |
465 | - if ($form_state['values']['menu']['type'] != 'none' && empty($form_state['values']['menu']['title'])) { |
|
466 | - form_error($form['menu']['title'], t('Title is required for this menu type.')); |
|
467 | - } |
|
468 | - break; |
|
465 | + if ($form_state['values']['menu']['type'] != 'none' && empty($form_state['values']['menu']['title'])) { |
|
466 | + form_error($form['menu']['title'], t('Title is required for this menu type.')); |
|
467 | + } |
|
468 | + break; |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
@@ -473,19 +473,19 @@ discard block |
||
473 | 473 | // It is very important to call the parent function here: |
474 | 474 | parent::options_submit($form, $form_state); |
475 | 475 | switch ($form_state['section']) { |
476 | - case 'path': |
|
477 | - $this->set_option('path', $form_state['values']['path']); |
|
478 | - break; |
|
479 | - case 'menu': |
|
480 | - $this->set_option('menu', $form_state['values']['menu']); |
|
481 | - // send ajax form to options page if we use it. |
|
482 | - if ($form_state['values']['menu']['type'] == 'default tab') { |
|
483 | - views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('tab_options')); |
|
484 | - } |
|
485 | - break; |
|
486 | - case 'tab_options': |
|
487 | - $this->set_option('tab_options', $form_state['values']['tab_options']); |
|
488 | - break; |
|
476 | + case 'path': |
|
477 | + $this->set_option('path', $form_state['values']['path']); |
|
478 | + break; |
|
479 | + case 'menu': |
|
480 | + $this->set_option('menu', $form_state['values']['menu']); |
|
481 | + // send ajax form to options page if we use it. |
|
482 | + if ($form_state['values']['menu']['type'] == 'default tab') { |
|
483 | + views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('tab_options')); |
|
484 | + } |
|
485 | + break; |
|
486 | + case 'tab_options': |
|
487 | + $this->set_option('tab_options', $form_state['values']['tab_options']); |
|
488 | + break; |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 |
@@ -7,16 +7,16 @@ |
||
7 | 7 | |
8 | 8 | function search_views_convert($display, $type, &$view, $field, $id = NULL) { |
9 | 9 | switch ($type) { |
10 | - case 'filter': |
|
11 | - switch ($field['tablename']) { |
|
12 | - case 'temp_search_results': |
|
13 | - switch ($field['field']) { |
|
14 | - case 'word': |
|
15 | - $view->set_item_option($display, 'filter', $id, 'table', 'search_index'); |
|
16 | - $view->set_item_option($display, 'filter', $id, 'field', 'keys'); |
|
17 | - break; |
|
18 | - } |
|
19 | - break; |
|
10 | + case 'filter': |
|
11 | + switch ($field['tablename']) { |
|
12 | + case 'temp_search_results': |
|
13 | + switch ($field['field']) { |
|
14 | + case 'word': |
|
15 | + $view->set_item_option($display, 'filter', $id, 'table', 'search_index'); |
|
16 | + $view->set_item_option($display, 'filter', $id, 'field', 'keys'); |
|
17 | + break; |
|
18 | + } |
|
19 | + break; |
|
20 | 20 | } |
21 | 21 | break; |
22 | 22 | } |
@@ -22,18 +22,18 @@ |
||
22 | 22 | $value = unserialize($value->{$this->field_alias}); |
23 | 23 | $format = $this->options['date_format']; |
24 | 24 | switch ($format) { |
25 | - case 'custom': |
|
26 | - $format = $this->options['custom_date_format']; |
|
27 | - break; |
|
28 | - case 'small': |
|
29 | - $format = variable_get('date_format_short', 'm/d/Y - H:i'); |
|
30 | - break; |
|
31 | - case 'medium': |
|
32 | - $format = variable_get('date_format_medium', 'D, m/d/Y - H:i'); |
|
33 | - break; |
|
34 | - case 'large': |
|
35 | - $format = variable_get('date_format_long', 'l, F j, Y - H:i'); |
|
36 | - break; |
|
25 | + case 'custom': |
|
26 | + $format = $this->options['custom_date_format']; |
|
27 | + break; |
|
28 | + case 'small': |
|
29 | + $format = variable_get('date_format_short', 'm/d/Y - H:i'); |
|
30 | + break; |
|
31 | + case 'medium': |
|
32 | + $format = variable_get('date_format_medium', 'D, m/d/Y - H:i'); |
|
33 | + break; |
|
34 | + case 'large': |
|
35 | + $format = variable_get('date_format_long', 'l, F j, Y - H:i'); |
|
36 | + break; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Note: Avoid PHP's date() because it does not handle dates before |
@@ -14,168 +14,168 @@ |
||
14 | 14 | */ |
15 | 15 | function node_views_convert($display, $type, &$view, $field, $id = NULL) { |
16 | 16 | switch ($type) { |
17 | - case 'field': |
|
18 | - switch ($field['tablename']) { |
|
19 | - case 'node': |
|
20 | - switch ($field['field']) { |
|
21 | - case 'title': |
|
22 | - if ($field['options'] != 'no_link') { |
|
23 | - $view->set_item_option($display, 'field', $id, 'link_to_node', TRUE); |
|
24 | - } |
|
25 | - break; |
|
26 | - case 'created': |
|
27 | - case 'changed': |
|
28 | - $handlers = array( |
|
29 | - 'views_handler_field_date_small' => 'small', |
|
30 | - 'views_handler_field_date' => 'medium', |
|
31 | - 'views_handler_field_date_large' => 'large', |
|
32 | - 'views_handler_field_date_custom' => 'custom', |
|
33 | - 'views_handler_field_since' => 'time ago', |
|
34 | - ); |
|
35 | - $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]); |
|
36 | - if (!empty($field['options'])) { |
|
37 | - $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']); |
|
38 | - } |
|
39 | - break; |
|
40 | - case 'body': |
|
41 | - $field['field'] = $field['handler'] == 'views_handler_field_teaser' ? 'teaser' : $field['field']; |
|
42 | - $view->set_item_option($display, 'field', $id, 'field', $field['field']); |
|
43 | - $view->set_item_option($display, 'field', $id, 'table', 'node_revisions'); |
|
44 | - break; |
|
45 | - case 'link': |
|
46 | - case 'edit': |
|
47 | - case 'delete': |
|
48 | - case 'view': |
|
49 | - $field['field'] = $field['field'] == 'link' ? 'view_node' : "$field[field]_node"; |
|
50 | - $view->set_item_option($display, 'field', $id, 'field', $field['field']); |
|
51 | - if (!empty($field['options'])) { |
|
52 | - $view->set_item_option($display, 'field', $id, 'text', $field['options']); |
|
53 | - } |
|
54 | - break; |
|
55 | - } |
|
56 | - break; |
|
17 | + case 'field': |
|
18 | + switch ($field['tablename']) { |
|
19 | + case 'node': |
|
20 | + switch ($field['field']) { |
|
21 | + case 'title': |
|
22 | + if ($field['options'] != 'no_link') { |
|
23 | + $view->set_item_option($display, 'field', $id, 'link_to_node', TRUE); |
|
24 | + } |
|
25 | + break; |
|
26 | + case 'created': |
|
27 | + case 'changed': |
|
28 | + $handlers = array( |
|
29 | + 'views_handler_field_date_small' => 'small', |
|
30 | + 'views_handler_field_date' => 'medium', |
|
31 | + 'views_handler_field_date_large' => 'large', |
|
32 | + 'views_handler_field_date_custom' => 'custom', |
|
33 | + 'views_handler_field_since' => 'time ago', |
|
34 | + ); |
|
35 | + $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]); |
|
36 | + if (!empty($field['options'])) { |
|
37 | + $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']); |
|
38 | + } |
|
39 | + break; |
|
40 | + case 'body': |
|
41 | + $field['field'] = $field['handler'] == 'views_handler_field_teaser' ? 'teaser' : $field['field']; |
|
42 | + $view->set_item_option($display, 'field', $id, 'field', $field['field']); |
|
43 | + $view->set_item_option($display, 'field', $id, 'table', 'node_revisions'); |
|
44 | + break; |
|
45 | + case 'link': |
|
46 | + case 'edit': |
|
47 | + case 'delete': |
|
48 | + case 'view': |
|
49 | + $field['field'] = $field['field'] == 'link' ? 'view_node' : "$field[field]_node"; |
|
50 | + $view->set_item_option($display, 'field', $id, 'field', $field['field']); |
|
51 | + if (!empty($field['options'])) { |
|
52 | + $view->set_item_option($display, 'field', $id, 'text', $field['options']); |
|
53 | + } |
|
54 | + break; |
|
55 | + } |
|
56 | + break; |
|
57 | 57 | } |
58 | 58 | break; |
59 | - case 'filter': |
|
60 | - switch ($field['tablename']) { |
|
61 | - case 'node': |
|
62 | - switch ($field['field']) { |
|
63 | - case 'type': |
|
64 | - $operators = array('OR' => 'in', 'NOR' => 'not in'); |
|
65 | - $view->set_item_option($display, 'filter', $id, 'operator', $operators[$field['operator']]); |
|
66 | - break; |
|
67 | - case 'anon': |
|
68 | - $item = $view->get_item($display, 'filter', $id); |
|
69 | - $item['value'] = array(0); |
|
70 | - $item['table'] = 'users'; |
|
71 | - $item['field'] = 'uid'; |
|
72 | - $view->set_item($display, 'filter', $id, $item); |
|
73 | - break; |
|
74 | - case 'currentuid': |
|
75 | - $operators = array('=' => TRUE, '!=' => FALSE); |
|
76 | - $item = $view->get_item($display, 'filter', $id); |
|
77 | - $item['value'] = $operators[$field['operator']]; |
|
78 | - $item['table'] = 'users'; |
|
79 | - $item['field'] = 'uid_current'; |
|
80 | - $view->set_item($display, 'filter', $id, $item); |
|
81 | - break; |
|
82 | - case 'currentuidtouched': |
|
83 | - $view->set_item_option($display, 'filter', $id, 'value', '='); |
|
84 | - $view->set_item_option($display, 'filter', $id, 'field', 'uid_touch'); |
|
85 | - break; |
|
86 | - case 'distinct': |
|
87 | - $view->display_handler->set_option('distinct', $field['operator'] == '=' && $field['value'] == 'distinct'); |
|
88 | - $view->set_item($display, 'filter', $id, NULL); |
|
89 | - break; |
|
90 | - case 'title': |
|
91 | - $item = $view->get_item($display, 'filter', $id); |
|
92 | - $item['operator'] = $field['operator']; |
|
93 | - $item['case'] = FALSE; |
|
94 | - $view->set_item($display, 'filter', $id, $item); |
|
95 | - break; |
|
96 | - case 'created': |
|
97 | - case 'changed': |
|
98 | - $item = $view->get_item($display, 'filter', $id); |
|
99 | - $item['operator'] = $field['operator']; |
|
100 | - $item['value'] = array( |
|
101 | - 'type' => $field['value'] == 'now' ? 'offset' : 'date', |
|
102 | - 'value' => $field['value'], |
|
103 | - ); |
|
104 | - if (!empty($field['options'])) { |
|
105 | - $item['value']['value'] = intval($field['options']) .' seconds'; |
|
106 | - } |
|
107 | - $view->set_item($display, 'filter', $id, $item); |
|
108 | - break; |
|
109 | - case 'body': |
|
110 | - $item = $view->get_item($display, 'filter', $id); |
|
111 | - $item['operator'] = $field['operator']; |
|
112 | - $item['case'] = FALSE; |
|
113 | - $item['table'] = 'node_revisions'; |
|
114 | - $view->set_item($display, 'filter', $id, $item); |
|
115 | - break; |
|
116 | - } |
|
117 | - break; |
|
118 | - case 'history': |
|
119 | - switch ($field['field']) { |
|
120 | - case 'timestamp': |
|
121 | - $view->set_item_option($display, 'filter', $id, 'table', 'history_user'); |
|
122 | - break; |
|
123 | - } |
|
124 | - break; |
|
125 | - } |
|
59 | + case 'filter': |
|
60 | + switch ($field['tablename']) { |
|
61 | + case 'node': |
|
62 | + switch ($field['field']) { |
|
63 | + case 'type': |
|
64 | + $operators = array('OR' => 'in', 'NOR' => 'not in'); |
|
65 | + $view->set_item_option($display, 'filter', $id, 'operator', $operators[$field['operator']]); |
|
66 | + break; |
|
67 | + case 'anon': |
|
68 | + $item = $view->get_item($display, 'filter', $id); |
|
69 | + $item['value'] = array(0); |
|
70 | + $item['table'] = 'users'; |
|
71 | + $item['field'] = 'uid'; |
|
72 | + $view->set_item($display, 'filter', $id, $item); |
|
73 | + break; |
|
74 | + case 'currentuid': |
|
75 | + $operators = array('=' => TRUE, '!=' => FALSE); |
|
76 | + $item = $view->get_item($display, 'filter', $id); |
|
77 | + $item['value'] = $operators[$field['operator']]; |
|
78 | + $item['table'] = 'users'; |
|
79 | + $item['field'] = 'uid_current'; |
|
80 | + $view->set_item($display, 'filter', $id, $item); |
|
81 | + break; |
|
82 | + case 'currentuidtouched': |
|
83 | + $view->set_item_option($display, 'filter', $id, 'value', '='); |
|
84 | + $view->set_item_option($display, 'filter', $id, 'field', 'uid_touch'); |
|
85 | + break; |
|
86 | + case 'distinct': |
|
87 | + $view->display_handler->set_option('distinct', $field['operator'] == '=' && $field['value'] == 'distinct'); |
|
88 | + $view->set_item($display, 'filter', $id, NULL); |
|
89 | + break; |
|
90 | + case 'title': |
|
91 | + $item = $view->get_item($display, 'filter', $id); |
|
92 | + $item['operator'] = $field['operator']; |
|
93 | + $item['case'] = FALSE; |
|
94 | + $view->set_item($display, 'filter', $id, $item); |
|
95 | + break; |
|
96 | + case 'created': |
|
97 | + case 'changed': |
|
98 | + $item = $view->get_item($display, 'filter', $id); |
|
99 | + $item['operator'] = $field['operator']; |
|
100 | + $item['value'] = array( |
|
101 | + 'type' => $field['value'] == 'now' ? 'offset' : 'date', |
|
102 | + 'value' => $field['value'], |
|
103 | + ); |
|
104 | + if (!empty($field['options'])) { |
|
105 | + $item['value']['value'] = intval($field['options']) .' seconds'; |
|
106 | + } |
|
107 | + $view->set_item($display, 'filter', $id, $item); |
|
108 | + break; |
|
109 | + case 'body': |
|
110 | + $item = $view->get_item($display, 'filter', $id); |
|
111 | + $item['operator'] = $field['operator']; |
|
112 | + $item['case'] = FALSE; |
|
113 | + $item['table'] = 'node_revisions'; |
|
114 | + $view->set_item($display, 'filter', $id, $item); |
|
115 | + break; |
|
116 | + } |
|
117 | + break; |
|
118 | + case 'history': |
|
119 | + switch ($field['field']) { |
|
120 | + case 'timestamp': |
|
121 | + $view->set_item_option($display, 'filter', $id, 'table', 'history_user'); |
|
126 | 122 | break; |
127 | - case 'sort': |
|
128 | - switch ($field['tablename']) { |
|
129 | - case 'node': |
|
130 | - switch ($field['field']) { |
|
131 | - case 'created': |
|
132 | - case 'changed': |
|
133 | - $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options']; |
|
134 | - $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']); |
|
135 | - break; |
|
136 | - case 'random': |
|
137 | - $view->set_item_option($display, 'sort', $id, 'table', 'views'); |
|
138 | - break; |
|
139 | - } |
|
123 | + } |
|
140 | 124 | break; |
141 | 125 | } |
142 | 126 | break; |
143 | - case 'argument': |
|
144 | - $options = $field['argoptions']; |
|
145 | - switch ($field['type']) { |
|
146 | - case 'nodetype': |
|
147 | - $view->add_item($display, 'argument', 'node', 'type', $options, $field['id']); |
|
148 | - break; |
|
149 | - case 'nodeletter': |
|
150 | - if (!empty($field['options'])) { |
|
151 | - $options['glossary'] = TRUE; |
|
152 | - $options['limit'] = $field['options']; |
|
153 | - } |
|
154 | - $options['case'] = 'upper'; |
|
155 | - $view->add_item($display, 'argument', 'node', 'title', $options, $field['id']); |
|
156 | - break; |
|
157 | - case 'year': |
|
158 | - $view->add_item($display, 'argument', 'node', 'created_year', $options, $field['id']); |
|
159 | - break; |
|
160 | - case 'month': |
|
161 | - $view->add_item($display, 'argument', 'node', 'created_month', $options, $field['id']); |
|
162 | - break; |
|
163 | - case 'week': |
|
164 | - $view->add_item($display, 'argument', 'node', 'created_week', $options, $field['id']); |
|
165 | - break; |
|
166 | - case 'monthyear': |
|
167 | - $view->add_item($display, 'argument', 'node', 'created_year_month', $options, $field['id']); |
|
168 | - break; |
|
169 | - case 'fulldate': |
|
170 | - $view->add_item($display, 'argument', 'node', 'created_fulldate', $options, $field['id']); |
|
171 | - break; |
|
172 | - case 'nid': |
|
173 | - if (!empty($field['options'])) { |
|
174 | - $options['not'] = TRUE; |
|
175 | - } |
|
176 | - $view->add_item($display, 'argument', 'node', 'nid', $options, $field['id']); |
|
177 | - break; |
|
127 | + case 'sort': |
|
128 | + switch ($field['tablename']) { |
|
129 | + case 'node': |
|
130 | + switch ($field['field']) { |
|
131 | + case 'created': |
|
132 | + case 'changed': |
|
133 | + $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options']; |
|
134 | + $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']); |
|
135 | + break; |
|
136 | + case 'random': |
|
137 | + $view->set_item_option($display, 'sort', $id, 'table', 'views'); |
|
138 | + break; |
|
139 | + } |
|
140 | + break; |
|
178 | 141 | } |
179 | 142 | break; |
143 | + case 'argument': |
|
144 | + $options = $field['argoptions']; |
|
145 | + switch ($field['type']) { |
|
146 | + case 'nodetype': |
|
147 | + $view->add_item($display, 'argument', 'node', 'type', $options, $field['id']); |
|
148 | + break; |
|
149 | + case 'nodeletter': |
|
150 | + if (!empty($field['options'])) { |
|
151 | + $options['glossary'] = TRUE; |
|
152 | + $options['limit'] = $field['options']; |
|
153 | + } |
|
154 | + $options['case'] = 'upper'; |
|
155 | + $view->add_item($display, 'argument', 'node', 'title', $options, $field['id']); |
|
156 | + break; |
|
157 | + case 'year': |
|
158 | + $view->add_item($display, 'argument', 'node', 'created_year', $options, $field['id']); |
|
159 | + break; |
|
160 | + case 'month': |
|
161 | + $view->add_item($display, 'argument', 'node', 'created_month', $options, $field['id']); |
|
162 | + break; |
|
163 | + case 'week': |
|
164 | + $view->add_item($display, 'argument', 'node', 'created_week', $options, $field['id']); |
|
165 | + break; |
|
166 | + case 'monthyear': |
|
167 | + $view->add_item($display, 'argument', 'node', 'created_year_month', $options, $field['id']); |
|
168 | + break; |
|
169 | + case 'fulldate': |
|
170 | + $view->add_item($display, 'argument', 'node', 'created_fulldate', $options, $field['id']); |
|
171 | + break; |
|
172 | + case 'nid': |
|
173 | + if (!empty($field['options'])) { |
|
174 | + $options['not'] = TRUE; |
|
175 | + } |
|
176 | + $view->add_item($display, 'argument', 'node', 'nid', $options, $field['id']); |
|
177 | + break; |
|
178 | + } |
|
179 | + break; |
|
180 | 180 | } |
181 | 181 | } |
@@ -60,62 +60,62 @@ |
||
60 | 60 | $type = isset($this->argument->options['validate_argument_nid_type']) ? $this->argument->options['validate_argument_nid_type'] : 'nid'; |
61 | 61 | |
62 | 62 | switch ($type) { |
63 | - case 'nid': |
|
64 | - if (!is_numeric($argument)) { |
|
65 | - return FALSE; |
|
66 | - } |
|
67 | - $node = node_load($argument); |
|
68 | - if (!$node) { |
|
63 | + case 'nid': |
|
64 | + if (!is_numeric($argument)) { |
|
65 | + return FALSE; |
|
66 | + } |
|
67 | + $node = node_load($argument); |
|
68 | + if (!$node) { |
|
69 | + return FALSE; |
|
70 | + } |
|
71 | + |
|
72 | + if (!empty($this->argument->options['validate_argument_node_access'])) { |
|
73 | + if (!node_access('view', $node)) { |
|
69 | 74 | return FALSE; |
70 | 75 | } |
76 | + } |
|
71 | 77 | |
72 | - if (!empty($this->argument->options['validate_argument_node_access'])) { |
|
73 | - if (!node_access('view', $node)) { |
|
74 | - return FALSE; |
|
75 | - } |
|
76 | - } |
|
78 | + // Save the title() handlers some work. |
|
79 | + $this->argument->validated_title = check_plain($node->title); |
|
77 | 80 | |
78 | - // Save the title() handlers some work. |
|
79 | - $this->argument->validated_title = check_plain($node->title); |
|
81 | + if (empty($types)) { |
|
82 | + return TRUE; |
|
83 | + } |
|
80 | 84 | |
81 | - if (empty($types)) { |
|
82 | - return TRUE; |
|
83 | - } |
|
85 | + return isset($types[$node->type]); |
|
86 | + break; |
|
87 | + case 'nids': |
|
88 | + $nids = new stdClass(); |
|
89 | + $nids->value = array($argument); |
|
90 | + $nids = views_break_phrase($argument, $nids); |
|
91 | + if ($nids->value == -1) { |
|
92 | + return FALSE; |
|
93 | + } |
|
84 | 94 | |
85 | - return isset($types[$node->type]); |
|
86 | - break; |
|
87 | - case 'nids': |
|
88 | - $nids = new stdClass(); |
|
89 | - $nids->value = array($argument); |
|
90 | - $nids = views_break_phrase($argument, $nids); |
|
91 | - if ($nids->value == -1) { |
|
92 | - return FALSE; |
|
93 | - } |
|
95 | + $placeholders = implode(', ', array_fill(0, sizeof($nids->value), '%d')); |
|
94 | 96 | |
95 | - $placeholders = implode(', ', array_fill(0, sizeof($nids->value), '%d')); |
|
97 | + $test = drupal_map_assoc($nids->value); |
|
98 | + $titles = array(); |
|
96 | 99 | |
97 | - $test = drupal_map_assoc($nids->value); |
|
98 | - $titles = array(); |
|
100 | + $result = db_query("SELECT * FROM {node} WHERE nid IN ($placeholders)", $nids->value); |
|
101 | + while ($node = db_fetch_object($result)) { |
|
102 | + if ($types && empty($types[$node->type])) { |
|
103 | + return FALSE; |
|
104 | + } |
|
99 | 105 | |
100 | - $result = db_query("SELECT * FROM {node} WHERE nid IN ($placeholders)", $nids->value); |
|
101 | - while ($node = db_fetch_object($result)) { |
|
102 | - if ($types && empty($types[$node->type])) { |
|
106 | + if (!empty($this->argument->options['validate_argument_node_access'])) { |
|
107 | + if (!node_access('view', $node)) { |
|
103 | 108 | return FALSE; |
104 | 109 | } |
105 | - |
|
106 | - if (!empty($this->argument->options['validate_argument_node_access'])) { |
|
107 | - if (!node_access('view', $node)) { |
|
108 | - return FALSE; |
|
109 | - } |
|
110 | - } |
|
111 | - |
|
112 | - $titles[] = check_plain($node->title); |
|
113 | - unset($test[$node->nid]); |
|
114 | 110 | } |
115 | 111 | |
116 | - $this->argument->validated_title = implode($nids->operator == 'or' ? ' + ' : ', ', $titles); |
|
117 | - // If this is not empty, we did not find a nid. |
|
118 | - return empty($test); |
|
112 | + $titles[] = check_plain($node->title); |
|
113 | + unset($test[$node->nid]); |
|
114 | + } |
|
115 | + |
|
116 | + $this->argument->validated_title = implode($nids->operator == 'or' ? ' + ' : ', ', $titles); |
|
117 | + // If this is not empty, we did not find a nid. |
|
118 | + return empty($test); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -121,18 +121,18 @@ |
||
121 | 121 | |
122 | 122 | // Prepare the item description |
123 | 123 | switch ($item_length) { |
124 | - case 'fulltext': |
|
125 | - $item->description = $node->body; |
|
126 | - break; |
|
127 | - case 'teaser': |
|
128 | - $item->description = $node->teaser; |
|
129 | - if (!empty($item->readmore)) { |
|
130 | - $item->description .= '<p>' . l(t('read more'), 'node/' . $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) . '</p>'; |
|
131 | - } |
|
132 | - break; |
|
133 | - case 'title': |
|
134 | - $item->description = ''; |
|
135 | - break; |
|
124 | + case 'fulltext': |
|
125 | + $item->description = $node->body; |
|
126 | + break; |
|
127 | + case 'teaser': |
|
128 | + $item->description = $node->teaser; |
|
129 | + if (!empty($item->readmore)) { |
|
130 | + $item->description .= '<p>' . l(t('read more'), 'node/' . $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) . '</p>'; |
|
131 | + } |
|
132 | + break; |
|
133 | + case 'title': |
|
134 | + $item->description = ''; |
|
135 | + break; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return theme($this->theme_functions(), $this->view, $this->options, $item); |
@@ -14,116 +14,116 @@ |
||
14 | 14 | */ |
15 | 15 | function comment_views_convert($display, $type, &$view, $field, $id = NULL) { |
16 | 16 | switch ($type) { |
17 | - case 'field': |
|
18 | - switch ($field['tablename']) { |
|
19 | - case 'comments': |
|
20 | - switch ($field['field']) { |
|
21 | - case 'subject': |
|
22 | - if ($field['options'] = 'nolink') { |
|
23 | - $view->set_item_option($display, 'field', $id, 'link_to_comment', FALSE); |
|
24 | - } |
|
25 | - break; |
|
26 | - case 'cid': |
|
27 | - $view->set_item_option($display, 'field', $id, 'link_to_comment', FALSE); |
|
28 | - break; |
|
29 | - case 'timestamp': |
|
30 | - $handlers = array( |
|
31 | - 'views_handler_field_date_small' => 'small', |
|
32 | - 'views_handler_field_date' => 'medium', |
|
33 | - 'views_handler_field_date_large' => 'large', |
|
34 | - 'views_handler_field_date_custom' => 'custom', |
|
35 | - 'views_handler_field_since' => 'time ago', |
|
36 | - ); |
|
37 | - $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]); |
|
38 | - if (!empty($field['options'])) { |
|
39 | - $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']); |
|
40 | - } |
|
41 | - break; |
|
42 | - case 'add': |
|
43 | - $view->set_item_option($display, 'field', $id, 'field', 'replyto_comment'); |
|
44 | - break; |
|
45 | - } |
|
46 | - break; |
|
47 | - case 'node_comment_statistics': |
|
48 | - switch ($field['field']) { |
|
49 | - case 'last_comment_timestamp': |
|
50 | - $handlers = array( |
|
51 | - 'views_handler_field_date_small' => 'small', |
|
52 | - 'views_handler_field_date' => 'medium', |
|
53 | - 'views_handler_field_date_large' => 'large', |
|
54 | - 'views_handler_field_date_custom' => 'custom', |
|
55 | - 'views_handler_field_since' => 'time ago', |
|
56 | - ); |
|
57 | - $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]); |
|
58 | - if (!empty($field['options'])) { |
|
59 | - $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']); |
|
60 | - } |
|
61 | - break; |
|
62 | - case 'last_changed': |
|
63 | - $handlers = array( |
|
64 | - 'views_handler_field_date_small' => 'small', |
|
65 | - 'views_handler_field_date' => 'medium', |
|
66 | - 'views_handler_field_date_large' => 'large', |
|
67 | - 'views_handler_field_date_custom' => 'custom', |
|
68 | - 'views_handler_field_since' => 'time ago', |
|
69 | - ); |
|
70 | - $item = $view->get_item($display, 'field', $id); |
|
71 | - $item['date_format'] = $handlers[$field['handler']]; |
|
72 | - if (!empty($field['options'])) { |
|
73 | - $item['custom_date_format'] = $field['options']; |
|
74 | - } |
|
75 | - $item['field'] = 'last_updated'; |
|
76 | - $view->set_item($display, 'field', $id, $item); |
|
77 | - break; |
|
78 | - } |
|
79 | - break; |
|
17 | + case 'field': |
|
18 | + switch ($field['tablename']) { |
|
19 | + case 'comments': |
|
20 | + switch ($field['field']) { |
|
21 | + case 'subject': |
|
22 | + if ($field['options'] = 'nolink') { |
|
23 | + $view->set_item_option($display, 'field', $id, 'link_to_comment', FALSE); |
|
24 | + } |
|
25 | + break; |
|
26 | + case 'cid': |
|
27 | + $view->set_item_option($display, 'field', $id, 'link_to_comment', FALSE); |
|
28 | + break; |
|
29 | + case 'timestamp': |
|
30 | + $handlers = array( |
|
31 | + 'views_handler_field_date_small' => 'small', |
|
32 | + 'views_handler_field_date' => 'medium', |
|
33 | + 'views_handler_field_date_large' => 'large', |
|
34 | + 'views_handler_field_date_custom' => 'custom', |
|
35 | + 'views_handler_field_since' => 'time ago', |
|
36 | + ); |
|
37 | + $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]); |
|
38 | + if (!empty($field['options'])) { |
|
39 | + $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']); |
|
40 | + } |
|
41 | + break; |
|
42 | + case 'add': |
|
43 | + $view->set_item_option($display, 'field', $id, 'field', 'replyto_comment'); |
|
44 | + break; |
|
45 | + } |
|
46 | + break; |
|
47 | + case 'node_comment_statistics': |
|
48 | + switch ($field['field']) { |
|
49 | + case 'last_comment_timestamp': |
|
50 | + $handlers = array( |
|
51 | + 'views_handler_field_date_small' => 'small', |
|
52 | + 'views_handler_field_date' => 'medium', |
|
53 | + 'views_handler_field_date_large' => 'large', |
|
54 | + 'views_handler_field_date_custom' => 'custom', |
|
55 | + 'views_handler_field_since' => 'time ago', |
|
56 | + ); |
|
57 | + $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]); |
|
58 | + if (!empty($field['options'])) { |
|
59 | + $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']); |
|
80 | 60 | } |
81 | 61 | break; |
82 | - case 'filter': |
|
83 | - switch ($field['tablename']) { |
|
84 | - case 'node_comment_statistics': |
|
85 | - switch ($field['field']) { |
|
86 | - case 'comment_count': |
|
87 | - $view->set_item_option($display, 'filter', $id, 'operator', $field['operator']); |
|
88 | - break; |
|
89 | - case 'last_changed': |
|
90 | - $field['field'] = 'last_updated'; |
|
91 | - case 'last_comment_timestamp': |
|
92 | - $item = $view->get_item($display, 'filter', $id); |
|
93 | - $item['operator'] = $field['operator']; |
|
94 | - $item['value'] = array( |
|
95 | - 'type' => $field['value'] == 'now' ? 'offset' : 'date', |
|
96 | - 'value' => $field['value'], |
|
97 | - ); |
|
98 | - if (!empty($field['options'])) { |
|
99 | - $item['value']['value'] = intval($field['options']) .' seconds'; |
|
100 | - } |
|
101 | - $item['field'] = $field['field']; |
|
102 | - $view->set_item($display, 'filter', $id, $item); |
|
103 | - break; |
|
104 | - } |
|
105 | - break; |
|
62 | + case 'last_changed': |
|
63 | + $handlers = array( |
|
64 | + 'views_handler_field_date_small' => 'small', |
|
65 | + 'views_handler_field_date' => 'medium', |
|
66 | + 'views_handler_field_date_large' => 'large', |
|
67 | + 'views_handler_field_date_custom' => 'custom', |
|
68 | + 'views_handler_field_since' => 'time ago', |
|
69 | + ); |
|
70 | + $item = $view->get_item($display, 'field', $id); |
|
71 | + $item['date_format'] = $handlers[$field['handler']]; |
|
72 | + if (!empty($field['options'])) { |
|
73 | + $item['custom_date_format'] = $field['options']; |
|
106 | 74 | } |
75 | + $item['field'] = 'last_updated'; |
|
76 | + $view->set_item($display, 'field', $id, $item); |
|
107 | 77 | break; |
108 | - case 'sort': |
|
109 | - switch ($field['tablename']) { |
|
110 | - case 'comments': |
|
111 | - switch ($field['field']) { |
|
112 | - case 'timestamp': |
|
113 | - $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options']; |
|
114 | - $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']); |
|
115 | - break; |
|
116 | - } |
|
78 | + } |
|
117 | 79 | break; |
118 | - case 'node_comment_statistics': |
|
119 | - switch ($field['field']) { |
|
120 | - case 'last_changed': |
|
121 | - $view->set_item_option($display, 'sort', $id, 'field', 'last_updated'); |
|
122 | - case 'last_comment_timestamp': |
|
123 | - $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options']; |
|
124 | - $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']); |
|
125 | - break; |
|
126 | - } |
|
80 | + } |
|
81 | + break; |
|
82 | + case 'filter': |
|
83 | + switch ($field['tablename']) { |
|
84 | + case 'node_comment_statistics': |
|
85 | + switch ($field['field']) { |
|
86 | + case 'comment_count': |
|
87 | + $view->set_item_option($display, 'filter', $id, 'operator', $field['operator']); |
|
88 | + break; |
|
89 | + case 'last_changed': |
|
90 | + $field['field'] = 'last_updated'; |
|
91 | + case 'last_comment_timestamp': |
|
92 | + $item = $view->get_item($display, 'filter', $id); |
|
93 | + $item['operator'] = $field['operator']; |
|
94 | + $item['value'] = array( |
|
95 | + 'type' => $field['value'] == 'now' ? 'offset' : 'date', |
|
96 | + 'value' => $field['value'], |
|
97 | + ); |
|
98 | + if (!empty($field['options'])) { |
|
99 | + $item['value']['value'] = intval($field['options']) .' seconds'; |
|
100 | + } |
|
101 | + $item['field'] = $field['field']; |
|
102 | + $view->set_item($display, 'filter', $id, $item); |
|
103 | + break; |
|
104 | + } |
|
105 | + break; |
|
106 | + } |
|
107 | + break; |
|
108 | + case 'sort': |
|
109 | + switch ($field['tablename']) { |
|
110 | + case 'comments': |
|
111 | + switch ($field['field']) { |
|
112 | + case 'timestamp': |
|
113 | + $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options']; |
|
114 | + $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']); |
|
115 | + break; |
|
116 | + } |
|
117 | + break; |
|
118 | + case 'node_comment_statistics': |
|
119 | + switch ($field['field']) { |
|
120 | + case 'last_changed': |
|
121 | + $view->set_item_option($display, 'sort', $id, 'field', 'last_updated'); |
|
122 | + case 'last_comment_timestamp': |
|
123 | + $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options']; |
|
124 | + $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']); |
|
125 | + break; |
|
126 | + } |
|
127 | 127 | break; |
128 | 128 | } |
129 | 129 | break; |