You are here

function expire_panels_entity_update in Panels Cache Expiration 7

Implements hook_entity_update().

File

./expire_panels.module, line 58

Code

function expire_panels_entity_update($entity, $type) {

  // Support for fieldable_panel_panes.
  if (isset($entity->fpid)) {
    $get_did = db_select('panels_pane', 'pp')
      ->fields('pp', array(
      'did',
    ))
      ->condition('subtype', 'fpid:' . $entity->fpid)
      ->execute()
      ->fetchAll();
    if (empty($get_did)) {

      // Current fpp doesn't added to panels at all.
      return;
    }
    foreach ($get_did as $did) {

      // Load display object from did.
      $display = panels_load_display($did->did);

      // Expire needed panel.
      expire_panels_execute_expiration('panels', $display, EXPIRE_PANELS_DISPLAY_UPDATE);
    }
  }
}