You are here

function PanelizerEntityDefault::delete_entity_panelizer in Panelizer 7.2

Same name and namespace in other branches
  1. 7.3 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::delete_entity_panelizer()
2 calls to PanelizerEntityDefault::delete_entity_panelizer()
PanelizerEntityDefault::hook_entity_delete in plugins/entity/PanelizerEntityDefault.class.php
PanelizerEntityDefault::page_settings in plugins/entity/PanelizerEntityDefault.class.php
Switched page callback to give the settings form.

File

plugins/entity/PanelizerEntityDefault.class.php, line 1207
Base class for the Panelizer Entity plugin.

Class

PanelizerEntityDefault
Base class for the Panelizer Entity plugin.

Code

function delete_entity_panelizer($entity) {
  list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);

  // Locate and delete all displays associated with the entity.
  $dids = db_query("SELECT did FROM {panelizer_entity} WHERE entity_type = '{$this->entity_type}' AND entity_id = :id", array(
    ':id' => $entity_id,
  ))
    ->fetchCol();
  foreach (array_unique($dids) as $did) {
    panels_delete_display($did);
  }
  db_delete('panelizer_entity')
    ->condition('entity_type', $this->entity_type)
    ->condition('entity_id', $entity_id)
    ->execute();
}