function rdf_mapping_save

rdf_mapping_save($mapping)

Saves an RDF mapping to the database.

Takes a mapping structure returned by hook_rdf_mapping() implementations and creates or updates a record mapping for each encountered entity type/bundle pair. If available, adds default values for non-existent mapping keys.

Parameters

$mapping: The RDF mapping to save, as an array.

Return value

Status flag indicating the outcome of the operation.

Related topics

File

modules/rdf/rdf.module, line 241
Enables semantically enriched output for Drupal sites in the form of RDFa.

Code

function rdf_mapping_save($mapping) {
  // In the case where a field has a mapping defined in the default entity
  // mapping, but a mapping is not specified in the bundle-specific mapping,
  // then use the default mapping for that field.
  $mapping['mapping'] += _rdf_get_default_mapping($mapping['type']);

  $status = db_merge('rdf_mapping')
    ->key(array(
      'type' => $mapping['type'],
      'bundle' => $mapping['bundle'],
    ))
    ->fields(array(
      'mapping' => serialize($mapping['mapping']),
    ))
    ->execute();

  entity_info_cache_clear();

  return $status;
}

© 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_mapping_save/7.x