public static function File::processFile

public static File::processFile(&$element, FormStateInterface $form_state, &$complete_form)

Processes a file upload element, make use of #multiple if present.

File

core/lib/Drupal/Core/Render/Element/File.php, line 45

Class

File
Provides a form element for uploading a file.

Namespace

Drupal\Core\Render\Element

Code

public static function processFile(&$element, FormStateInterface $form_state, &$complete_form) {
  if ($element['#multiple']) {
    $element['#attributes'] = array('multiple' => 'multiple');
    $element['#name'] .= '[]';
  }
  return $element;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Element!File.php/function/File::processFile/8.1.x