You are here

function _entity_entitycache_get_module_info in Entity API 7

Helper to fetch entity info about entity types that use caching.

1 call to _entity_entitycache_get_module_info()
entity_entitycache_installed_modules in ./entity.install
Create cache tables for entities of modules that support Entity cache module.

File

./entity.install, line 120
Install file for the entity API.

Code

function _entity_entitycache_get_module_info($modules) {

  // Prepare a keyed array of all modules with their entity types and infos.
  // Structure: [module][entity][info].
  $entity_crud_info = entity_crud_get_info();
  $info = array();
  foreach ($entity_crud_info as $entity_name => $entity_info) {

    // Make sure that entity_info specifies a module and supports entitycache.
    if (!isset($entity_info['module']) || empty($entity_info['entity cache'])) {
      continue;
    }
    $module = $entity_info['module'];

    // Only treat installed modules.
    if (!in_array($module, $modules)) {
      continue;
    }

    // Add the entity info to the module key.
    if (!isset($info[$module])) {
      $info[$module] = array();
    }
    $info[$module][$entity_name] = $entity_info;
  }
  return $info;
}