You are here

function _microdata_load_mapping in Microdata 7

Helper function to retrieve a microdata mapping from the database.

Parameters

string $entity_type: The entity type the mapping refers to.

string $bundle_type: The bundle the mapping refers to.

Return value

array An RDF mapping structure or an empty array if no record was found.

4 calls to _microdata_load_mapping()
microdata_bundle_type_mapping_form_submit in includes/microdata.form_alter.inc
Submit callback; saves the bundle-type specific mapping properties.
microdata_entity_info_alter in ./microdata.module
Implements hook_entity_info_alter().
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_export_render in ./microdata.features.inc
Implements hook_features_export_render().

File

./microdata.module, line 981

Code

function _microdata_load_mapping($entity_type, $bundle_type, $field = NULL) {
  $mapping = db_select('microdata_mapping')
    ->fields(NULL, array(
    'mapping',
  ))
    ->condition('type', $entity_type)
    ->condition('bundle', $bundle_type)
    ->execute()
    ->fetchField();
  if ($mapping) {
    $mapping = unserialize($mapping);
  }
  if (!is_array($mapping)) {

    // Return empty array also on unserialize error.
    $mapping = array();
  }
  return $mapping;
}