You are here

function _features_export_generate in Features 7.2

Return the $export array to be rendered for the feature export.

Parameters

array $export: Stub version of the export array.

array $form_state: Form state.

\stdClass|null $feature: Feature module info object.

Return value

array Export array.

2 calls to _features_export_generate()
features_export_build_form_submit in ./features.admin.inc
First submit handler 'Generate feature' and 'Download feature' buttons.
_features_export_form_components in ./features.admin.inc
Adds form elements for component selection on the export form.

File

./features.admin.inc, line 931
Forms for Features admin screens.

Code

function _features_export_generate($export, $form_state, $feature = NULL) {

  // Remove the UI data that we are not saving to disk.
  unset($export['components']);
  $module_name = $form_state['values']['module_name'];

  // Directly copy the following attributes from $form_state.
  $attr = array(
    'name',
    'description',
    'package',
    'project path',
  );
  foreach ($attr as $key) {
    $export[$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : NULL;
  }

  // Directly copy the following attributes from the original feature.
  $attr = array(
    'scripts',
    'stylesheets',
  );
  foreach ($attr as $key) {
    $export[$key] = isset($feature->info[$key]) ? $feature->info[$key] : NULL;
  }

  // If either update status-related keys are provided, add a project key
  // corresponding to the module name.
  if (!empty($form_state['values']['version']) && !empty($form_state['values']['project_status_url'])) {
    $export['project'] = $form_state['values']['module_name'];
  }
  if (!empty($form_state['values']['version'])) {
    $export['version'] = $form_state['values']['version'];
  }
  if (!empty($form_state['values']['project_status_url'])) {
    $export['project status url'] = $form_state['values']['project_status_url'];
  }
  $export['no autodetect'] = empty($form_state['values']['autodetect']) ? 1 : NULL;
  $export['project path'] = !empty($form_state['values']['generate_path']) ? $form_state['values']['generate_path'] : NULL;
  return $export;
}