rdf_mapping_save

Versions
7
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 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

Code

modules/rdf/rdf.module, line 164

<?php
function rdf_mapping_save(&$mapping) {
  // Adds default values for non-existent keys.
  $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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.