function _rdf_get_default_mapping

7.x rdf.module _rdf_get_default_mapping($type)

Helper function to get the default RDF mapping for a given entity type.

Parameters

$type: An entity type, e.g. 'node' or 'comment'.

Return value

The RDF mapping or an empty array if no mapping is defined for this entity type.

3 calls to _rdf_get_default_mapping()
rdf_entity_info_alter in drupal-7.x/modules/rdf/rdf.module
Implements hook_entity_info_alter().
rdf_mapping_load in drupal-7.x/modules/rdf/rdf.module
Returns the mapping for attributes of a given entity type/bundle pair.
rdf_mapping_save in drupal-7.x/modules/rdf/rdf.module
Saves an RDF mapping to the database.

File

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

Code

function _rdf_get_default_mapping($type) {
  $default_mappings = &drupal_static(__FUNCTION__);

  if (!isset($default_mappings)) {
    // Get all of the modules that implement hook_rdf_mapping().
    $modules = module_implements('rdf_mapping');

    // Only consider the default entity mapping definitions.
    foreach ($modules as $module) {
      $mappings = module_invoke($module, 'rdf_mapping');
      foreach ($mappings as $mapping) {
        if ($mapping['bundle'] === RDF_DEFAULT_BUNDLE) {
          $default_mappings[$mapping['type']] = $mapping['mapping'];
        }
      }
    }
  }

  return isset($default_mappings[$type]) ? $default_mappings[$type] : array();
}