Révision 64156087
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/panels/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 |
/** |
|
4 |
* @file |
|
5 |
*/ |
|
6 |
|
|
3 | 7 |
/** |
4 | 8 |
* Renderer class for all In-Place Editor (IPE) behavior. |
5 | 9 |
*/ |
... | ... | |
54 | 58 |
// @todo we may need an else to load the cache, but I am not sure we |
55 | 59 |
// actually need to load it if we already have our cache key, and doing |
56 | 60 |
// so is a waste of resources. |
57 |
|
|
58 | 61 |
ctools_include('cleanstring'); |
59 | 62 |
$this->clean_key = ctools_cleanstring($this->display->cache_key); |
60 | 63 |
$button = array( |
... | ... | |
91 | 94 |
'ipe_cache_key' => $this->clean_key, |
92 | 95 |
), |
93 | 96 |
|
94 |
'#prefix' => '<div class="panels-ipe-pseudobutton-container">', |
|
95 |
'#suffix' => '</div>', |
|
97 |
'#prefix' => '<div class="panels-ipe-pseudobutton-container">',
|
|
98 |
'#suffix' => '</div>',
|
|
96 | 99 |
); |
97 | 100 |
|
98 | 101 |
panels_ipe_toolbar_add_button($this->display->cache_key, 'panels-ipe-change-layout', $button); |
... | ... | |
156 | 159 |
|
157 | 160 |
if (empty($pane->IPE_empty)) { |
158 | 161 |
// Add an inner layer wrapper to the pane content before placing it into |
159 |
// draggable portlet |
|
162 |
// draggable portlet.
|
|
160 | 163 |
$output = "<div class=\"panels-ipe-portlet-content\">$output</div>"; |
161 | 164 |
} |
162 | 165 |
else { |
163 | 166 |
$output = "<div class=\"panels-ipe-portlet-content panels-ipe-empty-pane\">$output</div>"; |
164 | 167 |
} |
165 |
// Hand it off to the plugin/theme for placing draggers/buttons |
|
168 |
// Hand it off to the plugin/theme for placing draggers/buttons.
|
|
166 | 169 |
$output = theme('panels_ipe_pane_wrapper', array('output' => $output, 'pane' => $pane, 'display' => $this->display, 'renderer' => $this)); |
167 | 170 |
|
168 | 171 |
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'immovable') { |
... | ... | |
259 | 262 |
// Break the lock. |
260 | 263 |
panels_edit_cache_break_lock($this->cache); |
261 | 264 |
} |
262 |
}
|
|
265 |
} |
|
263 | 266 |
|
267 |
/** |
|
268 |
* |
|
269 |
*/ |
|
264 | 270 |
function get_panels_storage_op_for_ajax($method) { |
265 | 271 |
switch ($method) { |
266 | 272 |
case 'ajax_unlock_ipe': |
267 | 273 |
case 'ajax_save_form': |
268 | 274 |
return 'update'; |
275 |
|
|
269 | 276 |
case 'ajax_change_layout': |
270 | 277 |
case 'ajax_set_layout': |
271 | 278 |
return 'change layout'; |
... | ... | |
299 | 306 |
|
300 | 307 |
// Reset the $_POST['ajax_html_ids'] values to preserve |
301 | 308 |
// proper IDs on form elements when they are rebuilt |
302 |
// by the Panels IPE without refreshing the page |
|
309 |
// by the Panels IPE without refreshing the page.
|
|
303 | 310 |
$_POST['ajax_html_ids'] = array(); |
304 | 311 |
|
305 | 312 |
$form_state = array( |
... | ... | |
308 | 315 |
'content_types' => $this->cache->content_types, |
309 | 316 |
'rerender' => FALSE, |
310 | 317 |
'no_redirect' => TRUE, |
311 |
// Panels needs this to make sure that the layout gets callbacks |
|
318 |
// Panels needs this to make sure that the layout gets callbacks.
|
|
312 | 319 |
'layout' => $this->plugins['layout'], |
313 | 320 |
); |
314 | 321 |
|
... | ... | |
348 | 355 |
$buttons = &drupal_static('panels_ipe_toolbar_buttons', array()); |
349 | 356 |
$output = theme('panels_ipe_toolbar', array('buttons' => $buttons)); |
350 | 357 |
$this->commands[] = ajax_command_replace('#panels-ipe-control-container', $output); |
358 |
|
|
359 |
$storage_id = $this->cache->display->storage_id; |
|
360 |
cache_clear_all('panels_mini_load:' . $storage_id, 'cache_panels', TRUE); |
|
351 | 361 |
} |
352 | 362 |
else { |
353 | 363 |
// Cancelled. Clear the cache. |
... | ... | |
383 | 393 |
$layouts = panels_common_get_allowed_layouts('panels_page'); |
384 | 394 |
} |
385 | 395 |
|
386 |
// Filter out builders |
|
396 |
// Filter out builders.
|
|
387 | 397 |
$layouts = array_filter($layouts, '_panels_builder_filter'); |
388 | 398 |
|
389 | 399 |
// Let other modules filter the layouts. |
390 | 400 |
drupal_alter('panels_layouts_available', $layouts); |
391 | 401 |
|
392 |
// Define the current layout |
|
402 |
// Define the current layout.
|
|
393 | 403 |
$current_layout = $this->plugins['layout']['name']; |
394 | 404 |
|
395 | 405 |
$output = panels_common_print_layout_links($layouts, $this->get_url('set_layout'), array('attributes' => array('class' => array('use-ajax'))), $current_layout); |
... | ... | |
414 | 424 |
|
415 | 425 |
// Reset the $_POST['ajax_html_ids'] values to preserve |
416 | 426 |
// proper IDs on form elements when they are rebuilt |
417 |
// by the Panels IPE without refreshing the page |
|
427 |
// by the Panels IPE without refreshing the page.
|
|
418 | 428 |
$_POST['ajax_html_ids'] = array(); |
419 | 429 |
|
420 | 430 |
$output = drupal_build_form('panels_change_layout', $form_state); |
... | ... | |
485 | 495 |
'key' => $this->clean_key, |
486 | 496 |
); |
487 | 497 |
} |
498 |
|
|
488 | 499 |
} |
489 | 500 |
|
490 | 501 |
/** |
... | ... | |
493 | 504 |
function panels_ipe_edit_control_form($form, &$form_state) { |
494 | 505 |
$display = &$form_state['display']; |
495 | 506 |
// @todo -- this should be unnecessary as we ensure cache_key is set in add_meta() |
496 |
// $display->cache_key = isset($display->cache_key) ? $display->cache_key : $display->did; |
|
497 |
|
|
507 |
// $display->cache_key = isset($display->cache_key) ? $display->cache_key : $display->did; |
|
498 | 508 |
// Annoyingly, theme doesn't have access to form_state so we have to do this. |
499 | 509 |
$form['#display'] = $display; |
500 | 510 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules