Révision 5a7e6170
Ajouté par Florent Torregrosa il y a environ 10 ans
drupal7/sites/all/modules/panels/panels_node/panels_node.module | ||
---|---|---|
339 | 339 |
$display->css_id = $node->panels_node['css_id']; |
340 | 340 |
// TODO: Find a way to make sure this can't node_view. |
341 | 341 |
$display->context = panels_node_get_context($node); |
342 |
$display->cache_key = 'panels_node:' . $node->nid; |
|
342 | 343 |
$renderer = panels_get_renderer($node->panels_node['pipeline'], $display); |
343 | 344 |
$node->content['body'] = array( |
344 | 345 |
'#markup' => panels_render_display($display, $renderer), |
... | ... | |
429 | 430 |
'weight' => -1, |
430 | 431 |
); |
431 | 432 |
} |
433 |
|
|
434 |
// --------------------------------------------------------------------------- |
|
435 |
// Callbacks for panel caching. |
|
436 |
|
|
437 |
/** |
|
438 |
* Get display edit cache for a panel node being edited. |
|
439 |
* |
|
440 |
* The key is the second half of the key in this form: |
|
441 |
* panels_node:NID; |
|
442 |
*/ |
|
443 |
function panels_node_panels_cache_get($nid) { |
|
444 |
ctools_include('object-cache'); |
|
445 |
$cache = ctools_object_cache_get('panels_node_display_cache', $nid); |
|
446 |
if (empty($cache)) { |
|
447 |
$cache = new stdClass(); |
|
448 |
$node = node_load($nid); |
|
449 |
if (empty($node)) { |
|
450 |
return; |
|
451 |
} |
|
452 |
|
|
453 |
ctools_include('common', 'panels'); |
|
454 |
$cache->display = panels_load_display($node->panels_node['did']); |
|
455 |
$cache->display->css_id = $node->panels_node['css_id']; |
|
456 |
$cache->display->context = panels_node_get_context($node); |
|
457 |
$cache->display->cache_key = 'panels_node:' . $node->nid; |
|
458 |
$cache->content_types = panels_common_get_allowed_types('panels_node', $cache->display->context); |
|
459 |
$cache->allwed_layouts = panels_common_get_allowed_layouts('panels_node'); |
|
460 |
} |
|
461 |
|
|
462 |
return $cache; |
|
463 |
} |
|
464 |
|
|
465 |
/** |
|
466 |
* Store a display edit in progress in the panels cache. |
|
467 |
*/ |
|
468 |
function panels_node_panels_cache_set($nid, $cache) { |
|
469 |
ctools_include('object-cache'); |
|
470 |
ctools_object_cache_set('panels_node_display_cache', $nid, $cache); |
|
471 |
} |
|
472 |
|
|
473 |
/** |
|
474 |
* Clear all changes made to a display using the panels cache. |
|
475 |
*/ |
|
476 |
function panels_node_panels_cache_clear($nid, $cache) { |
|
477 |
ctools_include('object-cache'); |
|
478 |
ctools_object_cache_clear('panels_node_display_cache', $nid); |
|
479 |
} |
|
480 |
|
|
481 |
/** |
|
482 |
* React to a cache save and save the display and clear cache. |
|
483 |
*/ |
|
484 |
function panels_node_panels_cache_save($nid, $cache) { |
|
485 |
panels_save_display($cache->display); |
|
486 |
ctools_include('object-cache'); |
|
487 |
ctools_object_cache_clear('panels_node_display_cache', $nid); |
|
488 |
} |
Formats disponibles : Unified diff
Update :