You are here

function entitycache_supported_core_entities in Entity cache 7

Helper function to list all supported core entities.

Parameters

$enabled: If set, only return enabled modules.

Return value

An array of core entities.

3 calls to entitycache_supported_core_entities()
entitycache_entity_info_alter in ./entitycache.module
Implements hook_entity_info_alter().
entitycache_flush_caches in ./entitycache.module
Implements hook_flush_caches().
entitycache_schema in ./entitycache.install
Implements hook_schema().

File

./entitycache.module, line 40
Allows for caching of core entities.

Code

function entitycache_supported_core_entities($enabled = FALSE) {
  $return = array(
    'comment' => 'EntityCacheCommentController',
    'file' => 'EntityCacheDefaultEntityController',
    'node' => 'EntityCacheNodeController',
    'taxonomy_term' => 'EntityCacheTaxonomyTermController',
    'taxonomy_vocabulary' => 'EntityCacheTaxonomyVocabularyController',
    'user' => 'EntityCacheUserController',
  );

  // If the $enabled param is past, remove modules from the array if they're
  // not enabled.
  if ($enabled) {
    if (!module_exists('comment')) {
      unset($return['comment']);
    }
    if (!module_exists('taxonomy')) {
      unset($return['taxonomy_term']);
      unset($return['taxonomy_vocabulary']);
    }
    $return = array_diff_key($return, drupal_map_assoc(variable_get('entitycache_disabled_entity_types', array())));
  }
  return $return;
}