You are here

function microdata_mappings_features_export_render in Microdata 7

Implements hook_features_export_render().

File

./microdata.features.inc, line 58
Provides Features integration for microdata.

Code

function microdata_mappings_features_export_render($module, $data, $export = NULL) {
  $code = array();
  $code[] = '  $microdata_mappings = array();';
  $code[] = '';
  foreach ($data as $entity_type_bundle) {
    $parts = explode('-', $entity_type_bundle);
    $entity_type = $parts[0];
    $bundle_type = $parts[1];
    $microdata_mapping = _microdata_load_mapping($entity_type, $bundle_type);
    $microdata_mapping_export = features_var_export($microdata_mapping, '  ');
    $microdata_bundle = features_var_export($bundle_type);
    $microdata_entity_type = features_var_export($entity_type);
    $code[] = "  // Exported Microdata mapping: {$bundle_type}";
    $code[] = "  \$microdata_mappings[{$microdata_entity_type}][{$microdata_bundle}] = {$microdata_mapping_export};";
    $code[] = "";
  }
  $code[] = '  return $microdata_mappings;';
  $code = implode("\n", $code);
  return array(
    'microdata_mappings_defaults' => $code,
  );
}