@@ -148,168 +148,168 @@ discard block |
||
148 | 148 | parent::options_form($form, $form_state); |
149 | 149 | |
150 | 150 | switch ($form_state['section']) { |
151 | - case 'allow': |
|
152 | - $form['#title'] .= t('Allow settings'); |
|
153 | - $form['description'] = array( |
|
154 | - '#value' => '<div class="form-item description">' . t('Checked settings will be available in the panel pane config dialog for modification by the panels user. Unchecked settings will not be available and will only use the settings in this display.') . '</div>', |
|
151 | + case 'allow': |
|
152 | + $form['#title'] .= t('Allow settings'); |
|
153 | + $form['description'] = array( |
|
154 | + '#value' => '<div class="form-item description">' . t('Checked settings will be available in the panel pane config dialog for modification by the panels user. Unchecked settings will not be available and will only use the settings in this display.') . '</div>', |
|
155 | + ); |
|
156 | + |
|
157 | + $options = array( |
|
158 | + 'use_pager' => t('Use pager'), |
|
159 | + 'items_per_page' => t('Items per page'), |
|
160 | + 'offset' => t('Pager offset'), |
|
161 | + 'link_to_view' => t('Link to view'), |
|
162 | + 'more_link' => t('More link'), |
|
163 | + 'path_override' => t('Path override'), |
|
164 | + 'title_override' => t('Title override'), |
|
165 | + 'exposed_form' => t('Use exposed widgets form as pane configuration'), |
|
166 | + 'fields_override' => t('Fields override'), |
|
167 | + ); |
|
168 | + |
|
169 | + $allow = array_filter($this->get_option('allow')); |
|
170 | + $form['allow'] = array( |
|
171 | + '#type' => 'checkboxes', |
|
172 | + '#default_value' => $allow, |
|
173 | + '#options' => $options, |
|
174 | + ); |
|
175 | + break; |
|
176 | + case 'pane_title': |
|
177 | + $form['#title'] .= t('Administrative title'); |
|
178 | + |
|
179 | + $form['pane_title'] = array( |
|
180 | + '#type' => 'textfield', |
|
181 | + '#default_value' => $this->get_option('pane_title'), |
|
182 | + '#description' => t('This is the title that will appear for this view pane in the add content dialog. If left blank, the view name will be used.'), |
|
183 | + ); |
|
184 | + break; |
|
185 | + |
|
186 | + case 'pane_description': |
|
187 | + $form['#title'] .= t('Administrative description'); |
|
188 | + |
|
189 | + $form['pane_description'] = array( |
|
190 | + '#type' => 'textfield', |
|
191 | + '#default_value' => $this->get_option('pane_description'), |
|
192 | + '#description' => t('This is text that will be displayed when the user mouses over the pane in the add content dialog. If blank the view description will be used.'), |
|
193 | + ); |
|
194 | + break; |
|
195 | + |
|
196 | + case 'pane_category': |
|
197 | + $form['#title'] .= t('Administrative description'); |
|
198 | + |
|
199 | + $cat = $this->get_option('pane_category'); |
|
200 | + $form['pane_category']['#tree'] = TRUE; |
|
201 | + $form['pane_category']['name'] = array( |
|
202 | + '#type' => 'textfield', |
|
203 | + '#default_value' => $cat['name'], |
|
204 | + '#description' => t('This is category the pane will appear in on the add content dialog.'), |
|
205 | + ); |
|
206 | + $form['pane_category']['weight'] = array( |
|
207 | + '#title' => t('Weight'), |
|
208 | + '#type' => 'textfield', |
|
209 | + '#default_value' => $cat['weight'], |
|
210 | + '#description' => t('This is the default weight of the category. Note that if the weight of a category is defined in multiple places, only the first one Panels sees will get that definition, so if the weight does not appear to be working, check other places that the weight might be set.'), |
|
211 | + ); |
|
212 | + break; |
|
213 | + |
|
214 | + case 'link_to_view': |
|
215 | + $form['#title'] .= t('Link pane title to view'); |
|
216 | + |
|
217 | + $form['link_to_view'] = array( |
|
218 | + '#type' => 'select', |
|
219 | + '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
220 | + '#default_value' => $this->get_option('link_to_view'), |
|
221 | + ); |
|
222 | + break; |
|
223 | + |
|
224 | + case 'inherit_panels_path': |
|
225 | + $form['#title'] .= t('Inherit path from panel display'); |
|
226 | + |
|
227 | + $form['inherit_panels_path'] = array( |
|
228 | + '#type' => 'select', |
|
229 | + '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
230 | + '#default_value' => $this->get_option('inherit_panels_path'), |
|
231 | + '#description' => t('If yes, all links generated by Views, such as more links, summary links, and exposed input links will go to the panels display path, not the view, if the display has a path.'), |
|
232 | + ); |
|
233 | + break; |
|
234 | + |
|
235 | + case 'argument_input': |
|
236 | + $form['#title'] .= t('Choose the data source for view arguments'); |
|
237 | + $argument_input = $this->get_argument_input(); |
|
238 | + |
|
239 | + ctools_include('context'); |
|
240 | + $form['argument_input']['#tree'] = TRUE; |
|
241 | + |
|
242 | + foreach ($argument_input as $id => $argument) { |
|
243 | + $form['argument_input'][$id] = array( |
|
244 | + '#tree' => TRUE, |
|
155 | 245 | ); |
156 | 246 | |
157 | - $options = array( |
|
158 | - 'use_pager' => t('Use pager'), |
|
159 | - 'items_per_page' => t('Items per page'), |
|
160 | - 'offset' => t('Pager offset'), |
|
161 | - 'link_to_view' => t('Link to view'), |
|
162 | - 'more_link' => t('More link'), |
|
163 | - 'path_override' => t('Path override'), |
|
164 | - 'title_override' => t('Title override'), |
|
165 | - 'exposed_form' => t('Use exposed widgets form as pane configuration'), |
|
166 | - 'fields_override' => t('Fields override'), |
|
167 | - ); |
|
168 | - |
|
169 | - $allow = array_filter($this->get_option('allow')); |
|
170 | - $form['allow'] = array( |
|
171 | - '#type' => 'checkboxes', |
|
172 | - '#default_value' => $allow, |
|
173 | - '#options' => $options, |
|
174 | - ); |
|
175 | - break; |
|
176 | - case 'pane_title': |
|
177 | - $form['#title'] .= t('Administrative title'); |
|
247 | + $safe = str_replace(array('][', '_', ' '), '-', $id); |
|
248 | + $type_id = 'edit-argument-input-' . $safe; |
|
178 | 249 | |
179 | - $form['pane_title'] = array( |
|
180 | - '#type' => 'textfield', |
|
181 | - '#default_value' => $this->get_option('pane_title'), |
|
182 | - '#description' => t('This is the title that will appear for this view pane in the add content dialog. If left blank, the view name will be used.'), |
|
250 | + $form['argument_input'][$id]['type'] = array( |
|
251 | + '#type' => 'select', |
|
252 | + '#options' => array( |
|
253 | + 'none' => t('No argument'), |
|
254 | + 'wildcard' => t('Argument wildcard'), |
|
255 | + 'context' => t('From context'), |
|
256 | + 'panel' => t('From panel argument'), |
|
257 | + 'fixed' => t('Fixed'), |
|
258 | + 'user' => t('Input on pane config'), |
|
259 | + ), |
|
260 | + '#id' => $type_id, |
|
261 | + '#title' => t('@arg source', array('@arg' => $argument['name'])), |
|
262 | + '#default_value' => $argument['type'], |
|
183 | 263 | ); |
184 | - break; |
|
185 | 264 | |
186 | - case 'pane_description': |
|
187 | - $form['#title'] .= t('Administrative description'); |
|
188 | - |
|
189 | - $form['pane_description'] = array( |
|
190 | - '#type' => 'textfield', |
|
191 | - '#default_value' => $this->get_option('pane_description'), |
|
192 | - '#description' => t('This is text that will be displayed when the user mouses over the pane in the add content dialog. If blank the view description will be used.'), |
|
265 | + $form['argument_input'][$id]['context'] = array( |
|
266 | + '#type' => 'select', |
|
267 | + '#title' => t('Required context'), |
|
268 | + '#description' => t('If "From context" is selected, which type of context to use.'), |
|
269 | + '#default_value' => $argument['context'], |
|
270 | + '#options' => ctools_context_get_all_converters(), |
|
271 | + '#process' => array('views_process_dependency'), |
|
272 | + '#dependency' => array($type_id => array('context')), |
|
193 | 273 | ); |
194 | - break; |
|
195 | - |
|
196 | - case 'pane_category': |
|
197 | - $form['#title'] .= t('Administrative description'); |
|
198 | 274 | |
199 | - $cat = $this->get_option('pane_category'); |
|
200 | - $form['pane_category']['#tree'] = TRUE; |
|
201 | - $form['pane_category']['name'] = array( |
|
202 | - '#type' => 'textfield', |
|
203 | - '#default_value' => $cat['name'], |
|
204 | - '#description' => t('This is category the pane will appear in on the add content dialog.'), |
|
205 | - ); |
|
206 | - $form['pane_category']['weight'] = array( |
|
207 | - '#title' => t('Weight'), |
|
208 | - '#type' => 'textfield', |
|
209 | - '#default_value' => $cat['weight'], |
|
210 | - '#description' => t('This is the default weight of the category. Note that if the weight of a category is defined in multiple places, only the first one Panels sees will get that definition, so if the weight does not appear to be working, check other places that the weight might be set.'), |
|
275 | + $form['argument_input'][$id]['context_optional'] = array( |
|
276 | + '#type' => 'checkbox', |
|
277 | + '#title' => t('Context is optional'), |
|
278 | + '#description' => t('This context need not be present for the pane to function. If you plan to use this, ensure that the argument handler can handle empty values gracefully.'), |
|
279 | + '#default_value' => $argument['context_optional'], |
|
280 | + '#process' => array('views_process_dependency'), |
|
281 | + '#dependency' => array($type_id => array('context')), |
|
211 | 282 | ); |
212 | - break; |
|
213 | 283 | |
214 | - case 'link_to_view': |
|
215 | - $form['#title'] .= t('Link pane title to view'); |
|
216 | - |
|
217 | - $form['link_to_view'] = array( |
|
284 | + $form['argument_input'][$id]['panel'] = array( |
|
218 | 285 | '#type' => 'select', |
219 | - '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
220 | - '#default_value' => $this->get_option('link_to_view'), |
|
286 | + '#title' => t('Panel argument'), |
|
287 | + '#description' => t('If "From panel argument" is selected, which panel argument to use.'), |
|
288 | + '#default_value' => $argument['panel'], |
|
289 | + '#options' => array(0 => t('First'), 1 => t('Second'), 2 => t('Third'), 3 => t('Fourth'), 4 => t('Fifth'), 5 => t('Sixth')), |
|
290 | + '#process' => array('views_process_dependency'), |
|
291 | + '#dependency' => array($type_id => array('panel')), |
|
221 | 292 | ); |
222 | - break; |
|
223 | 293 | |
224 | - case 'inherit_panels_path': |
|
225 | - $form['#title'] .= t('Inherit path from panel display'); |
|
294 | + $form['argument_input'][$id]['fixed'] = array( |
|
295 | + '#type' => 'textfield', |
|
296 | + '#title' => t('Fixed argument'), |
|
297 | + '#description' => t('If "Fixed" is selected, what to use as an argument.'), |
|
298 | + '#default_value' => $argument['fixed'], |
|
299 | + '#process' => array('views_process_dependency'), |
|
300 | + '#dependency' => array($type_id => array('fixed')), |
|
301 | + ); |
|
226 | 302 | |
227 | - $form['inherit_panels_path'] = array( |
|
228 | - '#type' => 'select', |
|
229 | - '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
230 | - '#default_value' => $this->get_option('inherit_panels_path'), |
|
231 | - '#description' => t('If yes, all links generated by Views, such as more links, summary links, and exposed input links will go to the panels display path, not the view, if the display has a path.'), |
|
303 | + $form['argument_input'][$id]['label'] = array( |
|
304 | + '#type' => 'textfield', |
|
305 | + '#title' => t('Label'), |
|
306 | + '#description' => t('If this argument is presented to the panels user, what label to apply to it.'), |
|
307 | + '#default_value' => empty($argument['label']) ? $argument['name'] : $argument['label'], |
|
308 | + '#process' => array('views_process_dependency'), |
|
309 | + '#dependency' => array($type_id => array('user')), |
|
232 | 310 | ); |
233 | - break; |
|
234 | - |
|
235 | - case 'argument_input': |
|
236 | - $form['#title'] .= t('Choose the data source for view arguments'); |
|
237 | - $argument_input = $this->get_argument_input(); |
|
238 | - |
|
239 | - ctools_include('context'); |
|
240 | - $form['argument_input']['#tree'] = TRUE; |
|
241 | - |
|
242 | - foreach ($argument_input as $id => $argument) { |
|
243 | - $form['argument_input'][$id] = array( |
|
244 | - '#tree' => TRUE, |
|
245 | - ); |
|
246 | - |
|
247 | - $safe = str_replace(array('][', '_', ' '), '-', $id); |
|
248 | - $type_id = 'edit-argument-input-' . $safe; |
|
249 | - |
|
250 | - $form['argument_input'][$id]['type'] = array( |
|
251 | - '#type' => 'select', |
|
252 | - '#options' => array( |
|
253 | - 'none' => t('No argument'), |
|
254 | - 'wildcard' => t('Argument wildcard'), |
|
255 | - 'context' => t('From context'), |
|
256 | - 'panel' => t('From panel argument'), |
|
257 | - 'fixed' => t('Fixed'), |
|
258 | - 'user' => t('Input on pane config'), |
|
259 | - ), |
|
260 | - '#id' => $type_id, |
|
261 | - '#title' => t('@arg source', array('@arg' => $argument['name'])), |
|
262 | - '#default_value' => $argument['type'], |
|
263 | - ); |
|
264 | - |
|
265 | - $form['argument_input'][$id]['context'] = array( |
|
266 | - '#type' => 'select', |
|
267 | - '#title' => t('Required context'), |
|
268 | - '#description' => t('If "From context" is selected, which type of context to use.'), |
|
269 | - '#default_value' => $argument['context'], |
|
270 | - '#options' => ctools_context_get_all_converters(), |
|
271 | - '#process' => array('views_process_dependency'), |
|
272 | - '#dependency' => array($type_id => array('context')), |
|
273 | - ); |
|
274 | - |
|
275 | - $form['argument_input'][$id]['context_optional'] = array( |
|
276 | - '#type' => 'checkbox', |
|
277 | - '#title' => t('Context is optional'), |
|
278 | - '#description' => t('This context need not be present for the pane to function. If you plan to use this, ensure that the argument handler can handle empty values gracefully.'), |
|
279 | - '#default_value' => $argument['context_optional'], |
|
280 | - '#process' => array('views_process_dependency'), |
|
281 | - '#dependency' => array($type_id => array('context')), |
|
282 | - ); |
|
283 | - |
|
284 | - $form['argument_input'][$id]['panel'] = array( |
|
285 | - '#type' => 'select', |
|
286 | - '#title' => t('Panel argument'), |
|
287 | - '#description' => t('If "From panel argument" is selected, which panel argument to use.'), |
|
288 | - '#default_value' => $argument['panel'], |
|
289 | - '#options' => array(0 => t('First'), 1 => t('Second'), 2 => t('Third'), 3 => t('Fourth'), 4 => t('Fifth'), 5 => t('Sixth')), |
|
290 | - '#process' => array('views_process_dependency'), |
|
291 | - '#dependency' => array($type_id => array('panel')), |
|
292 | - ); |
|
293 | - |
|
294 | - $form['argument_input'][$id]['fixed'] = array( |
|
295 | - '#type' => 'textfield', |
|
296 | - '#title' => t('Fixed argument'), |
|
297 | - '#description' => t('If "Fixed" is selected, what to use as an argument.'), |
|
298 | - '#default_value' => $argument['fixed'], |
|
299 | - '#process' => array('views_process_dependency'), |
|
300 | - '#dependency' => array($type_id => array('fixed')), |
|
301 | - ); |
|
302 | - |
|
303 | - $form['argument_input'][$id]['label'] = array( |
|
304 | - '#type' => 'textfield', |
|
305 | - '#title' => t('Label'), |
|
306 | - '#description' => t('If this argument is presented to the panels user, what label to apply to it.'), |
|
307 | - '#default_value' => empty($argument['label']) ? $argument['name'] : $argument['label'], |
|
308 | - '#process' => array('views_process_dependency'), |
|
309 | - '#dependency' => array($type_id => array('user')), |
|
310 | - ); |
|
311 | - } |
|
312 | - break; |
|
311 | + } |
|
312 | + break; |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
@@ -321,15 +321,15 @@ discard block |
||
321 | 321 | // It is very important to call the parent function here: |
322 | 322 | parent::options_submit($form, $form_state); |
323 | 323 | switch ($form_state['section']) { |
324 | - case 'allow': |
|
325 | - case 'argument_input': |
|
326 | - case 'link_to_view': |
|
327 | - case 'inherit_panels_path': |
|
328 | - case 'pane_title': |
|
329 | - case 'pane_description': |
|
330 | - case 'pane_category': |
|
331 | - $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
332 | - break; |
|
324 | + case 'allow': |
|
325 | + case 'argument_input': |
|
326 | + case 'link_to_view': |
|
327 | + case 'inherit_panels_path': |
|
328 | + case 'pane_title': |
|
329 | + case 'pane_description': |
|
330 | + case 'pane_category': |
|
331 | + $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
332 | + break; |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 |
@@ -163,42 +163,42 @@ |
||
163 | 163 | $context_keys = array_keys($contexts); |
164 | 164 | foreach ($view->display_handler->get_argument_input() as $id => $argument) { |
165 | 165 | switch ($argument['type']) { |
166 | - case 'context': |
|
167 | - $key = array_shift($context_keys); |
|
168 | - if (isset($contexts [$key])) { |
|
169 | - if (strpos($argument['context'], '.')) { |
|
170 | - list($context, $converter) = explode('.', $argument['context'], 2); |
|
171 | - $args[] = ctools_context_convert_context($contexts[$key], $converter); |
|
172 | - } |
|
173 | - else { |
|
174 | - $args[] = $contexts[$key]->argument; |
|
175 | - } |
|
166 | + case 'context': |
|
167 | + $key = array_shift($context_keys); |
|
168 | + if (isset($contexts [$key])) { |
|
169 | + if (strpos($argument['context'], '.')) { |
|
170 | + list($context, $converter) = explode('.', $argument['context'], 2); |
|
171 | + $args[] = ctools_context_convert_context($contexts[$key], $converter); |
|
176 | 172 | } |
177 | - break; |
|
178 | - |
|
179 | - case 'fixed': |
|
180 | - $args[] = $argument['fixed']; |
|
181 | - break; |
|
182 | - |
|
183 | - case 'panel': |
|
184 | - $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL; |
|
185 | - break; |
|
186 | - |
|
187 | - case 'user': |
|
188 | - $args[] = (isset($conf['arguments'][$id]) && $conf['arguments'][$id] !== '') ? $conf['arguments'][$id] : NULL; |
|
189 | - break; |
|
190 | - |
|
191 | - case 'wildcard': |
|
192 | - // Put in the wildcard. |
|
193 | - $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*'; |
|
194 | - break; |
|
195 | - |
|
196 | - case 'none': |
|
197 | - default: |
|
198 | - // Put in NULL. |
|
199 | - // views.module knows what to do with NULL (or missing) arguments |
|
200 | - $args[] = NULL; |
|
201 | - break; |
|
173 | + else { |
|
174 | + $args[] = $contexts[$key]->argument; |
|
175 | + } |
|
176 | + } |
|
177 | + break; |
|
178 | + |
|
179 | + case 'fixed': |
|
180 | + $args[] = $argument['fixed']; |
|
181 | + break; |
|
182 | + |
|
183 | + case 'panel': |
|
184 | + $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL; |
|
185 | + break; |
|
186 | + |
|
187 | + case 'user': |
|
188 | + $args[] = (isset($conf['arguments'][$id]) && $conf['arguments'][$id] !== '') ? $conf['arguments'][$id] : NULL; |
|
189 | + break; |
|
190 | + |
|
191 | + case 'wildcard': |
|
192 | + // Put in the wildcard. |
|
193 | + $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*'; |
|
194 | + break; |
|
195 | + |
|
196 | + case 'none': |
|
197 | + default: |
|
198 | + // Put in NULL. |
|
199 | + // views.module knows what to do with NULL (or missing) arguments |
|
200 | + $args[] = NULL; |
|
201 | + break; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 |
@@ -364,26 +364,26 @@ discard block |
||
364 | 364 | function ctools_shutdown_handler() { |
365 | 365 | if (function_exists('error_get_last') AND ($error = error_get_last())){ |
366 | 366 | switch($error['type']){ |
367 | - case E_ERROR: |
|
368 | - case E_CORE_ERROR: |
|
369 | - case E_COMPILE_ERROR: |
|
370 | - case E_USER_ERROR: |
|
371 | - // Do this manually because including files here is dangerous. |
|
372 | - $commands = array( |
|
373 | - array( |
|
374 | - 'command' => 'alert', |
|
375 | - 'title' => t('Error'), |
|
376 | - 'text' => t('Unable to complete operation. Fatal error in @file on line @line: @message', array( |
|
377 | - '@file' => $error['file'], |
|
378 | - '@line' => $error['line'], |
|
379 | - '@message' => $error['message'], |
|
380 | - )), |
|
381 | - ), |
|
382 | - ); |
|
383 | - |
|
384 | - // Change the status code so that the client will read the AJAX returned. |
|
385 | - header('HTTP/1.1 200 OK'); |
|
386 | - drupal_json($commands); |
|
367 | + case E_ERROR: |
|
368 | + case E_CORE_ERROR: |
|
369 | + case E_COMPILE_ERROR: |
|
370 | + case E_USER_ERROR: |
|
371 | + // Do this manually because including files here is dangerous. |
|
372 | + $commands = array( |
|
373 | + array( |
|
374 | + 'command' => 'alert', |
|
375 | + 'title' => t('Error'), |
|
376 | + 'text' => t('Unable to complete operation. Fatal error in @file on line @line: @message', array( |
|
377 | + '@file' => $error['file'], |
|
378 | + '@line' => $error['line'], |
|
379 | + '@message' => $error['message'], |
|
380 | + )), |
|
381 | + ), |
|
382 | + ); |
|
383 | + |
|
384 | + // Change the status code so that the client will read the AJAX returned. |
|
385 | + header('HTTP/1.1 200 OK'); |
|
386 | + drupal_json($commands); |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
@@ -569,19 +569,19 @@ discard block |
||
569 | 569 | foreach ($tokens as $token => $key) { |
570 | 570 | list($type, $argument) = $key; |
571 | 571 | switch ($type) { |
572 | - case 'variable': |
|
573 | - $temp_tokens[$token] = isset($variables[$argument]) ? $variables[$argument] : ''; |
|
574 | - break; |
|
575 | - case 'callback': |
|
576 | - if (is_string($argument) && function_exists($argument)) { |
|
577 | - $temp_tokens[$token] = $argument($variables); |
|
578 | - } |
|
579 | - if (is_array($argument) && function_exists($argument[0])) { |
|
580 | - $function = array_shift($argument); |
|
581 | - $argument = array_merge(array(&$variables), $argument); |
|
582 | - $temp_tokens[$token] = call_user_func_array($function, $argument); |
|
583 | - } |
|
584 | - break; |
|
572 | + case 'variable': |
|
573 | + $temp_tokens[$token] = isset($variables[$argument]) ? $variables[$argument] : ''; |
|
574 | + break; |
|
575 | + case 'callback': |
|
576 | + if (is_string($argument) && function_exists($argument)) { |
|
577 | + $temp_tokens[$token] = $argument($variables); |
|
578 | + } |
|
579 | + if (is_array($argument) && function_exists($argument[0])) { |
|
580 | + $function = array_shift($argument); |
|
581 | + $argument = array_merge(array(&$variables), $argument); |
|
582 | + $temp_tokens[$token] = call_user_func_array($function, $argument); |
|
583 | + } |
|
584 | + break; |
|
585 | 585 | } |
586 | 586 | } |
587 | 587 | $tokens = $temp_tokens; |
@@ -82,21 +82,21 @@ |
||
82 | 82 | function list_build_row($item, &$form_state, $operations) { |
83 | 83 | // Set up sorting |
84 | 84 | switch ($form_state['values']['order']) { |
85 | - case 'disabled': |
|
86 | - $this->sorts[$item->name] = empty($item->disabled) . $item->admin_title; |
|
87 | - break; |
|
88 | - case 'title': |
|
89 | - $this->sorts[$item->name] = $item->admin_title; |
|
90 | - break; |
|
91 | - case 'name': |
|
92 | - $this->sorts[$item->name] = $item->name; |
|
93 | - break; |
|
94 | - case 'category': |
|
95 | - $this->sorts[$item->name] = $item->category; |
|
96 | - break; |
|
97 | - case 'storage': |
|
98 | - $this->sorts[$item->name] = $item->type . $item->admin_title; |
|
99 | - break; |
|
85 | + case 'disabled': |
|
86 | + $this->sorts[$item->name] = empty($item->disabled) . $item->admin_title; |
|
87 | + break; |
|
88 | + case 'title': |
|
89 | + $this->sorts[$item->name] = $item->admin_title; |
|
90 | + break; |
|
91 | + case 'name': |
|
92 | + $this->sorts[$item->name] = $item->name; |
|
93 | + break; |
|
94 | + case 'category': |
|
95 | + $this->sorts[$item->name] = $item->category; |
|
96 | + break; |
|
97 | + case 'storage': |
|
98 | + $this->sorts[$item->name] = $item->type . $item->admin_title; |
|
99 | + break; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $this->rows[$item->name] = array( |
@@ -111,24 +111,24 @@ |
||
111 | 111 | function list_build_row($item, &$form_state, $operations) { |
112 | 112 | // Set up sorting |
113 | 113 | switch ($form_state['values']['order']) { |
114 | - case 'disabled': |
|
115 | - $this->sorts[$item->name] = empty($item->disabled) . $item->admin_title; |
|
116 | - break; |
|
117 | - case 'title': |
|
118 | - $this->sorts[$item->name] = $item->admin_title; |
|
119 | - break; |
|
120 | - case 'name': |
|
121 | - $this->sorts[$item->name] = $item->name; |
|
122 | - break; |
|
123 | - case 'type': |
|
124 | - $this->sorts[$item->name] = $this->style_plugin['type'] . $item->admin_title; |
|
125 | - break; |
|
126 | - case 'base': |
|
127 | - $this->sorts[$item->name] = $this->style_plugin['title'] . $item->admin_title; |
|
128 | - break; |
|
129 | - case 'storage': |
|
130 | - $this->sorts[$item->name] = $item->type . $item->admin_title; |
|
131 | - break; |
|
114 | + case 'disabled': |
|
115 | + $this->sorts[$item->name] = empty($item->disabled) . $item->admin_title; |
|
116 | + break; |
|
117 | + case 'title': |
|
118 | + $this->sorts[$item->name] = $item->admin_title; |
|
119 | + break; |
|
120 | + case 'name': |
|
121 | + $this->sorts[$item->name] = $item->name; |
|
122 | + break; |
|
123 | + case 'type': |
|
124 | + $this->sorts[$item->name] = $this->style_plugin['type'] . $item->admin_title; |
|
125 | + break; |
|
126 | + case 'base': |
|
127 | + $this->sorts[$item->name] = $this->style_plugin['title'] . $item->admin_title; |
|
128 | + break; |
|
129 | + case 'storage': |
|
130 | + $this->sorts[$item->name] = $item->type . $item->admin_title; |
|
131 | + break; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | if (!empty($this->base_types[$this->style_plugin['module']][$this->style_plugin['type']])) { |
@@ -123,12 +123,12 @@ |
||
123 | 123 | */ |
124 | 124 | function simplecontext_convert($context, $type) { |
125 | 125 | switch ($type) { |
126 | - case 'item1': |
|
127 | - return $context->data->item1; |
|
128 | - case 'item2': |
|
129 | - return $context->data->item2; |
|
130 | - case 'description': |
|
131 | - return $context->data->description; |
|
126 | + case 'item1': |
|
127 | + return $context->data->item1; |
|
128 | + case 'item2': |
|
129 | + return $context->data->item2; |
|
130 | + case 'description': |
|
131 | + return $context->data->description; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 |
@@ -342,24 +342,24 @@ discard block |
||
342 | 342 | } |
343 | 343 | // Set up sorting |
344 | 344 | switch ($form_state['values']['order']) { |
345 | - case 'disabled': |
|
346 | - $sorts[$name] = !$form_state['pages']['disabled'][$name] . $data['data']['title']['data']; |
|
347 | - break; |
|
348 | - case 'title': |
|
349 | - $sorts[$name] = $data['data']['title']['data']; |
|
350 | - break; |
|
351 | - case 'name': |
|
352 | - $sorts[$name] = $data['data']['name']['data']; |
|
353 | - break; |
|
354 | - case 'path': |
|
355 | - $sorts[$name] = $data['data']['path']['data']; |
|
356 | - break; |
|
357 | - case 'type': |
|
358 | - $sorts[$name] = $data['data']['type']['data']; |
|
359 | - break; |
|
360 | - case 'storage': |
|
361 | - $sorts[$name] = $data['data']['storage']['data']; |
|
362 | - break; |
|
345 | + case 'disabled': |
|
346 | + $sorts[$name] = !$form_state['pages']['disabled'][$name] . $data['data']['title']['data']; |
|
347 | + break; |
|
348 | + case 'title': |
|
349 | + $sorts[$name] = $data['data']['title']['data']; |
|
350 | + break; |
|
351 | + case 'name': |
|
352 | + $sorts[$name] = $data['data']['name']['data']; |
|
353 | + break; |
|
354 | + case 'path': |
|
355 | + $sorts[$name] = $data['data']['path']['data']; |
|
356 | + break; |
|
357 | + case 'type': |
|
358 | + $sorts[$name] = $data['data']['type']['data']; |
|
359 | + break; |
|
360 | + case 'storage': |
|
361 | + $sorts[$name] = $data['data']['storage']['data']; |
|
362 | + break; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
@@ -506,19 +506,19 @@ discard block |
||
506 | 506 | $operation['type'] = 'operation'; |
507 | 507 | } |
508 | 508 | switch ($operation['type']) { |
509 | - case 'handlers': |
|
510 | - $result[$id] = page_manager_get_handler_operations($page); |
|
511 | - break; |
|
512 | - case 'function': |
|
513 | - if (function_exists($operation['function'])) { |
|
514 | - $retval = $function($page, $operation); |
|
515 | - if (is_array($retval)) { |
|
516 | - $result[$id] = $retval; |
|
517 | - } |
|
509 | + case 'handlers': |
|
510 | + $result[$id] = page_manager_get_handler_operations($page); |
|
511 | + break; |
|
512 | + case 'function': |
|
513 | + if (function_exists($operation['function'])) { |
|
514 | + $retval = $function($page, $operation); |
|
515 | + if (is_array($retval)) { |
|
516 | + $result[$id] = $retval; |
|
518 | 517 | } |
519 | - break; |
|
520 | - default: |
|
521 | - $result[$id] = $operation; |
|
518 | + } |
|
519 | + break; |
|
520 | + default: |
|
521 | + $result[$id] = $operation; |
|
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
@@ -1138,56 +1138,56 @@ discard block |
||
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | switch ($operation['type']) { |
1141 | - case 'text': |
|
1142 | - $output[$location] .= $operation['title']; |
|
1143 | - break; |
|
1144 | - case 'operation': |
|
1145 | - $path = isset($operation['path']) ? $operation['path'] : 'admin/build/pages/nojs/operation'; |
|
1146 | - if (!isset($operation['no task'])) { |
|
1147 | - $path .= '/' . $page->task_name; |
|
1148 | - } |
|
1141 | + case 'text': |
|
1142 | + $output[$location] .= $operation['title']; |
|
1143 | + break; |
|
1144 | + case 'operation': |
|
1145 | + $path = isset($operation['path']) ? $operation['path'] : 'admin/build/pages/nojs/operation'; |
|
1146 | + if (!isset($operation['no task'])) { |
|
1147 | + $path .= '/' . $page->task_name; |
|
1148 | + } |
|
1149 | 1149 | |
1150 | - if (!isset($operation['no operations'])) { |
|
1151 | - $path .= '/' . $current_path; |
|
1152 | - if (isset($operation['arguments'])) { |
|
1153 | - $path .= '/' . $arguments; |
|
1154 | - } |
|
1150 | + if (!isset($operation['no operations'])) { |
|
1151 | + $path .= '/' . $current_path; |
|
1152 | + if (isset($operation['arguments'])) { |
|
1153 | + $path .= '/' . $arguments; |
|
1155 | 1154 | } |
1155 | + } |
|
1156 | 1156 | |
1157 | - $class = 'page-manager-operation'; |
|
1158 | - if (!isset($operation['ajax']) || !empty($operation['ajax'])) { |
|
1159 | - $class .= ' ctools-use-ajax'; |
|
1160 | - } |
|
1161 | - if (!empty($operation['class'])) { |
|
1162 | - $class .= ' ' . $operation['class']; |
|
1163 | - } |
|
1157 | + $class = 'page-manager-operation'; |
|
1158 | + if (!isset($operation['ajax']) || !empty($operation['ajax'])) { |
|
1159 | + $class .= ' ctools-use-ajax'; |
|
1160 | + } |
|
1161 | + if (!empty($operation['class'])) { |
|
1162 | + $class .= ' ' . $operation['class']; |
|
1163 | + } |
|
1164 | 1164 | |
1165 | - $description = isset($operation['description']) ? $operation['description'] : ''; |
|
1166 | - if (empty($operation['silent']) && !empty($page->changes[$current_path])) { |
|
1167 | - $description .= ' ' . t('This setting contains unsaved changes.'); |
|
1168 | - } |
|
1165 | + $description = isset($operation['description']) ? $operation['description'] : ''; |
|
1166 | + if (empty($operation['silent']) && !empty($page->changes[$current_path])) { |
|
1167 | + $description .= ' ' . t('This setting contains unsaved changes.'); |
|
1168 | + } |
|
1169 | 1169 | |
1170 | - $output[$location] .= l($operation['title'], $path, array('attributes' => array('id' => 'page-manager-operation-' . $id, 'class' => $class, 'title' => $description), 'html' => TRUE)); |
|
1171 | - break; |
|
1172 | - case 'group': |
|
1173 | - if ($active == $id) { |
|
1174 | - $trail = $active_trail; |
|
1175 | - array_shift($trail); |
|
1176 | - } |
|
1177 | - else { |
|
1178 | - $trail = array(); |
|
1179 | - } |
|
1180 | - $group_location = isset($operation['location']) ? $operation['location'] : $location; |
|
1181 | - $temp = page_manager_render_operations($page, $operation['children'], $trail, $operation, $group_location, array_merge($parents, array($id))); |
|
1182 | - if ($temp) { |
|
1183 | - foreach ($temp as $id => $text) { |
|
1184 | - if (empty($output[$id])) { |
|
1185 | - $output[$id] = ''; |
|
1186 | - } |
|
1187 | - $output[$id] .= $text; |
|
1170 | + $output[$location] .= l($operation['title'], $path, array('attributes' => array('id' => 'page-manager-operation-' . $id, 'class' => $class, 'title' => $description), 'html' => TRUE)); |
|
1171 | + break; |
|
1172 | + case 'group': |
|
1173 | + if ($active == $id) { |
|
1174 | + $trail = $active_trail; |
|
1175 | + array_shift($trail); |
|
1176 | + } |
|
1177 | + else { |
|
1178 | + $trail = array(); |
|
1179 | + } |
|
1180 | + $group_location = isset($operation['location']) ? $operation['location'] : $location; |
|
1181 | + $temp = page_manager_render_operations($page, $operation['children'], $trail, $operation, $group_location, array_merge($parents, array($id))); |
|
1182 | + if ($temp) { |
|
1183 | + foreach ($temp as $id => $text) { |
|
1184 | + if (empty($output[$id])) { |
|
1185 | + $output[$id] = ''; |
|
1188 | 1186 | } |
1187 | + $output[$id] .= $text; |
|
1189 | 1188 | } |
1190 | - break; |
|
1189 | + } |
|
1190 | + break; |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | if (empty($operation['location']) || $operation['location'] == $location) { |
@@ -164,24 +164,24 @@ |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | switch ($menu['type']) { |
167 | - case 'none': |
|
168 | - default: |
|
169 | - $item['type'] = MENU_CALLBACK; |
|
170 | - break; |
|
171 | - |
|
172 | - case 'normal': |
|
173 | - $item['type'] = MENU_NORMAL_ITEM; |
|
174 | - // Insert item into the proper menu |
|
175 | - $item['menu_name'] = $menu['name']; |
|
176 | - break; |
|
177 | - |
|
178 | - case 'tab': |
|
179 | - $item['type'] = MENU_LOCAL_TASK; |
|
180 | - break; |
|
181 | - |
|
182 | - case 'default tab': |
|
183 | - $item['type'] = MENU_DEFAULT_LOCAL_TASK; |
|
184 | - break; |
|
167 | + case 'none': |
|
168 | + default: |
|
169 | + $item['type'] = MENU_CALLBACK; |
|
170 | + break; |
|
171 | + |
|
172 | + case 'normal': |
|
173 | + $item['type'] = MENU_NORMAL_ITEM; |
|
174 | + // Insert item into the proper menu |
|
175 | + $item['menu_name'] = $menu['name']; |
|
176 | + break; |
|
177 | + |
|
178 | + case 'tab': |
|
179 | + $item['type'] = MENU_LOCAL_TASK; |
|
180 | + break; |
|
181 | + |
|
182 | + case 'default tab': |
|
183 | + $item['type'] = MENU_DEFAULT_LOCAL_TASK; |
|
184 | + break; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return $item; |
@@ -665,15 +665,15 @@ |
||
665 | 665 | if ($page->menu['type'] != 'none') { |
666 | 666 | $menu .= ' ' . t('Title: %title.', array('%title' => $page->menu['title'])); |
667 | 667 | switch ($page->menu['type']) { |
668 | - case 'default tab': |
|
669 | - $menu .= ' ' . t('Parent title: %title.', array('%title' => $page->menu['parent']['title'])); |
|
670 | - break; |
|
671 | - case 'normal': |
|
672 | - if (module_exists('menu')) { |
|
673 | - $menus = menu_get_menus(); |
|
674 | - $menu .= ' ' . t('Menu block: %title.', array('%title' => $menus[$page->menu['name']])); |
|
675 | - } |
|
676 | - break; |
|
668 | + case 'default tab': |
|
669 | + $menu .= ' ' . t('Parent title: %title.', array('%title' => $page->menu['parent']['title'])); |
|
670 | + break; |
|
671 | + case 'normal': |
|
672 | + if (module_exists('menu')) { |
|
673 | + $menus = menu_get_menus(); |
|
674 | + $menu .= ' ' . t('Menu block: %title.', array('%title' => $menus[$page->menu['name']])); |
|
675 | + } |
|
676 | + break; |
|
677 | 677 | } |
678 | 678 | } |
679 | 679 | } |