1 entityreference.module entityreference_flush_caches()

Implements hook_flush_caches().

File

core/modules/entityreference/entityreference.module, line 34
Entityreference primary module file.

Code

function entityreference_flush_caches() {
  // Because of the intricacies of the info hooks, keep a separate list of the
  // base tables of each entities, so that entityreference_field_schema() can
  // be used without calling entity_get_info().
  // @see https://drupal.org/node/1416558
  $base_tables = array();
  foreach (entity_get_info() as $entity_type => $entity_info) {
    if (!empty($entity_info['base table']) && !empty($entity_info['entity keys']['id'])) {
      $base_tables[$entity_type] = array($entity_info['base table'], $entity_info['entity keys']['id']);
    }
  }
  // Use state because cache is going to be cleared right after
  // hook_flush_caches() is finished.
  state_set('entityreference_base_tables', $base_tables);
}