You are here

function uuid_node_features_export_render in UUID Features Integration 6

Same name and namespace in other branches
  1. 7 includes/uuid_node.features.inc \uuid_node_features_export_render()

Implementation of hook_features_export_render().

File

includes/uuid_node.features.inc, line 61
Features hooks for the uuid_node features component.

Code

function uuid_node_features_export_render($module, $data) {
  $translatables = $code = array();
  uuid_features_load_module_includes();
  $code[] = '  $nodes = array();';
  $code[] = '';
  foreach ($data as $uuid) {
    $node = node_get_by_uuid($uuid);
    if (!empty($node->path)) {
      $node->pathauto_perform_alias = FALSE;
    }
    $export = $node;

    // Use date instead of created, in the same format used by node_object_prepare.
    $export->date = format_date($export->created, 'custom', 'Y-m-d H:i:s O');

    // Don't cause conflicts with the legacy nid/vid fields.
    unset($export->nid);
    unset($export->vid);

    // The hook_alter signature is:
    // hook_uuid_node_features_export_render_alter(&$export, $node, $module);
    drupal_alter('uuid_node_features_export_render', $export, $node, $module);
    $code[] = '  $nodes[] = ' . features_var_export($export) . ';';
  }
  if (!empty($translatables)) {
    $code[] = features_translatables_export($translatables, '  ');
  }
  $code[] = '  return $nodes;';
  $code = implode("\n", $code);
  return array(
    'uuid_features_default_content' => $code,
  );
}