panels_panel_context_save

  1. drupal
    1. 6 panel_context.inc function
    2. 7 panel_context.inc function
Drupal 7 panels_panel_context_save(&$handler, $update)

Callback to allow the handler to react to being saved.

When a handler with a display is saved, two things have to happen. First, we have to save the display so that it becomes a real display, not the fake one we started with. Second, we have to cache any CSS that the display is using. This CSS can get re-cached later if the file disappears, but it's imperative that we do it here to make sure that old, dirty CSS cache gets removed.

File

sites/all/modules/panels/plugins/task_handlers/panel_context.inc, line 318
This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.

Code

function panels_panel_context_save(&$handler, $update) {
  // Only save the display if we believe it has been modified.
  if (isset($handler->conf['display'])) {
    panels_save_display($handler->conf['display']);
    $handler->conf['did'] = $handler->conf['display']->did;
    unset($handler->conf['display']);
  }

  // Delete any previous CSS cache file.
  ctools_include('css');
  ctools_css_clear('panel_context:' . $handler->name);

  if (isset($page->conf['temp_layout'])) {
    unset($page->conf['temp_layout']);
  }
}