You are here

public function FileModuleTestForm::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php \Drupal\file_module_test\Form\FileModuleTestForm::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

core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php, line 74
Contains \Drupal\file_module_test\Form\FileModuleTestForm.

Class

FileModuleTestForm
Form controller for file_module_test module.

Namespace

Drupal\file_module_test\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form['#tree']) {
    $uploads = $form_state
      ->getValue(array(
      'nested',
      'file',
    ));
  }
  else {
    $uploads = $form_state
      ->getValue('file');
  }
  if ($form['nested']['file']['#extended']) {
    $uploads = $uploads['fids'];
  }
  $fids = array();
  foreach ($uploads as $fid) {
    $fids[] = $fid;
  }
  drupal_set_message($this
    ->t('The file ids are %fids.', array(
    '%fids' => implode(',', $fids),
  )));
}