function rdf_entity_info_alter

7.x rdf.module rdf_entity_info_alter(&$entity_info)

Implements hook_entity_info_alter().

Adds the proper RDF mapping to each entity type/bundle pair.

@todo May need to move the comment below to another place. This hook should not be used by modules to alter the bundle mappings. The UI should always be authoritative. UI mappings are stored in the database and if hook_entity_info_alter was used to override module defined mappings, it would override the user defined mapping as well.

File

drupal-7.x/modules/rdf/rdf.module, line 368
Enables semantically enriched output for Drupal sites in the form of RDFa.

Code

function rdf_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) {
        if ($mapping = _rdf_mapping_load($entity_type, $bundle)) {
          $entity_info[$entity_type]['bundles'][$bundle]['rdf_mapping'] = $mapping;
        }
        else {
          // If no mapping was found in the database, assign the default RDF
          // mapping for this entity type.
          $entity_info[$entity_type]['bundles'][$bundle]['rdf_mapping'] = _rdf_get_default_mapping($entity_type);
        }
      }
    }
  }
}