You are here

function panelizer_export_save_callback in Panelizer 7.3

Same name and namespace in other branches
  1. 6 panelizer.module \panelizer_export_save_callback()
  2. 7 panelizer.module \panelizer_export_save_callback()
  3. 7.2 panelizer.module \panelizer_export_save_callback()

export.inc callback to properly save a panelizer default.

1 string reference to 'panelizer_export_save_callback'
panelizer_schema in ./panelizer.install
Implements hook_schema().

File

./panelizer.module, line 1108
The Panelizer module attaches panels to entities, providing default panels and allowing each panel to be configured independently by privileged users.

Code

function panelizer_export_save_callback(&$object) {
  if (!empty($object->display)) {
    $object->display->storage_id = $object->name;

    // First write the display.
    panels_save_display($object->display);

    // Make sure we have the did.
    $object->did = $object->display->did;
  }

  // Then write the default
  if ($object->export_type & EXPORT_IN_DATABASE) {

    // Existing record.
    $update = array(
      'pnid',
    );
  }
  else {

    // New record.
    $update = array();
    $object->export_type = EXPORT_IN_DATABASE;
  }

  // Reset the entity's cache. If the EntityCache module is enabled, this also
  // resets its permanent cache.
  list($entity_type, ) = explode(':', $object->name);
  entity_get_controller($entity_type)
    ->resetCache();
  return drupal_write_record('panelizer_defaults', $object, $update);
}