function microdata_save_mapping in Microdata 7
Saves a Microdata mapping to the database. If RDF is enabled, it also saves an RDF mapping.
Takes a mapping structure returned by hook_microdata_mapping() implementations and creates or updates a record mapping for each encountered entity type/bundle pair.
Parameters
string $entity_type: The entity type of the bundle.
string $bundle: The bundle type of the bundle.
array $mapping: The Microdata mapping to save, as an array.
Return value
boolean Status flag indicating the outcome of the operation.
Related topics
4 calls to microdata_save_mapping()
- MicrodataFieldTestCase::setUp in ./
microdata.test - Implements DrupalWebTestCase::setUp().
- microdata_bundle_type_mapping_form_submit in includes/
microdata.form_alter.inc - Submit callback; saves the bundle-type specific mapping properties.
- microdata_form_field_ui_field_edit_form_submit in includes/
microdata.form_alter.inc - Submit callback; saves field mapping in both UIs.
- microdata_mappings_features_rebuild in ./
microdata.features.inc - Implements hook_features_rebuild().
File
- ./
microdata.module, line 690
Code
function microdata_save_mapping($entity_type, $bundle, $mapping) {
$status = db_merge('microdata_mapping')
->key(array(
'type' => $entity_type,
'bundle' => $bundle,
))
->fields(array(
'mapping' => serialize($mapping),
))
->execute();
if (module_exists('rdf')) {
// @ TODO If rdf is enabled, add to the rdf_mappings table as well.
}
entity_info_cache_clear();
return $status;
}