function entity_entity_info_alter

7.x entity.module entity_entity_info_alter(&$entity_info)

Implements hook_entity_info_alter().

See also

entity_module_implements_alter()

File

entity/entity.module, line 1465
Module file for the entity API.

Code

function entity_entity_info_alter(&$entity_info) {
  _entity_info_add_metadata($entity_info);

  // Populate a default value for the 'configuration' key of all entity types.
  foreach ($entity_info as $type => $info) {
    if (!isset($info['configuration'])) {
      $entity_info[$type]['configuration'] = !empty($info['exportable']);
    }

    if (isset($info['controller class']) && in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
      // Automatically disable field cache when entity cache is used.
      if (!empty($info['entity cache']) && module_exists('entitycache')) {
        $entity_info[$type]['field cache'] = FALSE;
      }
    }
  }
}