You are here

function uuid_fpp_features_export_render in UUID Features Integration 7

Implements hook_features_export_render().

File

includes/uuid_fpp.features.inc, line 75
Features hooks for the uuid_fpp features component.

Code

function uuid_fpp_features_export_render($module, $data) {
  $translatables = $code = array();
  $code[] = '  $fpps = array();';
  $code[] = '';
  foreach ($data as $uuid) {

    // @todo reset = TRUE as otherwise references (parent, fields) were
    // destroyed.
    $fpps = entity_uuid_load('fieldable_panels_pane', array(
      $uuid,
    ), array(), TRUE);
    if (!count($fpps)) {
      continue;
    }
    $first_fpp = reset($fpps);
    $export = clone $first_fpp;
    $entity_type = 'fieldable_panels_pane';
    drupal_alter('uuid_entity_features_export_render', $entity_type, $export, $first_fpp, $module);

    // Do not export ids.
    unset($export->vid);
    unset($export->fpid);
    unset($export->current_vid);
    unset($export->changed);
    unset($export->uid);
    uuid_features_file_field_export($export, 'fieldable_panels_pane');
    $json = json_encode($export);
    $export_array = json_decode($json, TRUE);
    $code[] = '  $fpps[] = ' . features_var_export($export_array, '  ') . ';';
  }
  if (!empty($translatables)) {
    $code[] = features_translatables_export($translatables, '  ');
  }
  $code[] = '  return $fpps;';
  $code = implode("\n", $code);
  return array(
    'uuid_features_default_fpps' => $code,
  );
}