You are here

protected function FileFormField::initialize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Field/FileFormField.php \Symfony\Component\DomCrawler\Field\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 96

Class

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

Namespace

Symfony\Component\DomCrawler\Field

Code

protected function initialize() {
  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);
}