You are here

function microdata_entity_info_alter in Microdata 7

Implements hook_entity_info_alter().

Adds the Microdata mapping to each entity type/bundle pair.

File

./microdata.module, line 205

Code

function microdata_entity_info_alter(&$entity_info) {

  // Loop through each entity type and its bundles.
  foreach ($entity_info as $entity_type => $entity_type_info) {
    if (isset($entity_type_info['bundles'])) {
      foreach ($entity_type_info['bundles'] as $bundle => $bundle_info) {
        $entity_info[$entity_type]['bundles'][$bundle]['microdata_mapping'] = _microdata_load_mapping($entity_type, $bundle);
      }
    }
  }

  // If this is called the entity info cache is rebuild and we need to rebuild
  // the mapping cache as well.
  drupal_static_reset('microdata_get_mapping');

  // Don't use wildcard flushing to enhance compatibility with memory caches
  // like memcache / redis. Wildcards are hard to handle and we know the keys.
  foreach (language_list() as $language) {
    cache_clear_all('microdata_get_mapping:' . $language->language, 'cache');
  }
}