You are here

function uuid_vocabulary_features_export_render in UUID Features Integration 6

Implementation of hook_features_export_render().

File

includes/uuid_vocabulary.features.inc, line 44
Features hooks for the uuid_vocabulary features component.

Code

function uuid_vocabulary_features_export_render($module = 'foo', $data) {
  $translatables = $code = array();
  $code[] = '  $vocabularies = array();';
  $code[] = '';
  foreach ($data as $uuid) {
    $vid = uuid_get_serial_id('vocabulary', 'vid', $uuid);
    $vocab = taxonomy_vocabulary_load($vid);
    if (!$vocab) {
      continue;
    }
    $export = array(
      'uuid' => $uuid,
    );

    // Whitelist of vocabulary properties.
    $props = array(
      'name',
      'description',
      'help',
      'relations',
      'heirarchy',
      'multiple',
      'required',
      'tags',
      'module',
      'weight',
      'nodes',
    );
    foreach ($props as $key) {
      if (isset($vocab->{$key})) {
        $export[$key] = $vocab->{$key};
      }
    }
    $code[] = '  $vocabularies[] = ' . features_var_export($export, '  ') . ';';
  }
  if (!empty($translatables)) {
    $code[] = features_translatables_export($translatables, '  ');
  }
  $code[] = '  return $vocabularies;';
  $code = implode("\n", $code);
  return array(
    'uuid_features_default_vocabularies' => $code,
  );
}