You are here

function fe_taxonomy_vocabulary_features_export_render in Features Extra 6

Implementation of hook_features_export_render().

File

./fe_taxonomy.module, line 81

Code

function fe_taxonomy_vocabulary_features_export_render($module_name = '', $data) {
  ctools_include('export');
  $component = 'fe_taxonomy_vocabulary';
  $schema = ctools_export_get_schema($component);
  $objects = ctools_export_load_object($component);
  $code = array();
  $code[] = '  $export = array();';
  $code[] = '';
  foreach ($data as $machine_name) {

    // The object to be exported.
    if ($object = $objects[$machine_name]) {
      $additions = array();

      // Load vocabulary.
      if (!empty($object->vid)) {
        $vocabulary = taxonomy_vocabulary_load($object->vid);
        $additions = (array) $vocabulary;
        unset($additions['vid']);
      }

      // Code.
      $identifier = $schema['export']['identifier'];
      $code[] = ctools_export_object($component, $object, '  ', $identifier, $additions);
      $code[] = '  $export[\'' . $machine_name . '\'] = $' . $identifier . ';';
      $code[] = '';
    }
  }
  $code[] = '  return $export;';
  $code = implode("\n", $code);
  return array(
    $schema['export']['default hook'] => $code,
  );
}