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

Breadcrumb

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

function FileFormField::initialize

Initializes the form field.

Throws

\LogicException When node type is incorrect

Overrides FormField::initialize

File

vendor/symfony/dom-crawler/Field/FileFormField.php, line 91

Class

FileFormField
FileFormField represents a file form field (an HTML file input tag).

Namespace

Symfony\Component\DomCrawler\Field

Code

protected function initialize() : void {
    if ('input' !== $this->node->nodeName) {
        throw new \LogicException(\sprintf('A FileFormField can only be created from an input tag (%s given).', $this->node->nodeName));
    }
    if ('file' !== strtolower($this->node
        ->getAttribute('type'))) {
        throw new \LogicException(\sprintf('A FileFormField can only be created from an input tag with a type of file (given type is "%s").', $this->node
            ->getAttribute('type')));
    }
    $this->setValue(null);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal