function _rdf_get_default_mapping

_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.

File

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();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!rdf!rdf.module/function/_rdf_get_default_mapping/7.x