Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Form.php

function Form::getFiles

Gets the file field values.

1 call to Form::getFiles()
Form::getPhpFiles in vendor/symfony/dom-crawler/Form.php
Gets the file field values as PHP.

File

vendor/symfony/dom-crawler/Form.php, line 94

Class

Form
Form represents an HTML form.

Namespace

Symfony\Component\DomCrawler

Code

public function getFiles() : array {
    if (!\in_array($this->getMethod(), [
        'POST',
        'PUT',
        'DELETE',
        'PATCH',
    ])) {
        return [];
    }
    $files = [];
    foreach ($this->fields
        ->all() as $name => $field) {
        if ($field->isDisabled()) {
            continue;
        }
        if ($field instanceof Field\FileFormField) {
            $files[$name] = $field->getValue();
        }
    }
    return $files;
}
RSS feed
Powered by Drupal