You are here

function entity_reference_multiple_flush_caches in Entity Reference Multiple 7

Same name and namespace in other branches
  1. 7.2 entity_reference_multiple.module \entity_reference_multiple_flush_caches()

Implements hook_flush_caches().

File

./entity_reference_multiple.module, line 25
Primarily Drupal hooks.

Code

function entity_reference_multiple_flush_caches() {

  // Because of the intricacies of the info hooks, we are forced to keep a
  // separate list of the base tables of each entities, so that we can use
  // it in entityreference_field_schema() without calling entity_get_info().
  // See http://drupal.org/node/1416558 for details.
  $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'],
      );
    }
  }

  // We are using a variable because cache is going to be cleared right after
  // hook_flush_caches() is finished.
  variable_set('entity_reference_multiple:base-tables', $base_tables);
}