You are here

public function FeaturesExportForm::submitForm in Features 8.3

Same name and namespace in other branches
  1. 8.4 modules/features_ui/src/Form/FeaturesExportForm.php \Drupal\features_ui\Form\FeaturesExportForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

modules/features_ui/src/Form/FeaturesExportForm.php, line 545

Class

FeaturesExportForm
Defines the configuration export form.

Namespace

Drupal\features_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $current_bundle = $this->assigner
    ->loadBundle();
  $this->assigner
    ->assignConfigPackages();
  $package_names = array_filter($form_state
    ->getValue('preview'));
  if (empty($package_names)) {
    $this
      ->messenger()
      ->addWarning($this
      ->t('Please select one or more packages to export.'));
    return;
  }
  $method_id = NULL;
  $trigger = $form_state
    ->getTriggeringElement();
  $op = $form_state
    ->getValue('op');
  if (!empty($trigger) && empty($op)) {
    $method_id = $trigger['#name'];
  }
  if (!empty($method_id)) {
    $this->generator
      ->generatePackages($method_id, $current_bundle, $package_names);
    $this->generator
      ->applyExportFormSubmit($method_id, $form, $form_state);
  }
}