You are here

function synonyms_features_export_render in Synonyms 7

Implements hook_features_export_render().

File

./synonyms.features.inc, line 75
Synonyms module integration with Features.

Code

function synonyms_features_export_render($module_name, $data, $export = NULL) {
  $code = array();
  $code[] = '  $synonyms = array();';
  foreach ($data as $name) {
    list($entity_type, $bundle, $provider, $behavior) = explode(':', $name);
    $behavior_implementation = synonyms_behavior_get_all_enabled($entity_type, $bundle, $provider, $behavior);
    $behavior_implementation = reset($behavior_implementation);
    if (is_array($behavior_implementation)) {
      $behavior_implementation = array_intersect_key($behavior_implementation, drupal_map_assoc(array(
        'entity_type',
        'bundle',
        'provider',
        'settings',
        'behavior',
      )));
    }
    $code[] = "  \$synonyms['{$name}'] = " . features_var_export($behavior_implementation, '  ') . ";";
  }
  $code[] = "  return \$synonyms;";
  $code = implode("\n", $code);
  return array(
    'default_synonyms' => $code,
  );
}