function InputFormField::initialize
Initializes the form field.
Throws
\LogicException When node type is incorrect
Overrides FormField::initialize
File
-
vendor/
symfony/ dom-crawler/ Field/ InputFormField.php, line 29
Class
- InputFormField
- InputFormField represents an input form field (an HTML input tag).
Namespace
Symfony\Component\DomCrawler\FieldCode
protected function initialize() : void {
if ('input' !== $this->node->nodeName && 'button' !== $this->node->nodeName) {
throw new \LogicException(\sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName));
}
$type = strtolower($this->node
->getAttribute('type'));
if ('checkbox' === $type) {
throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
}
if ('file' === $type) {
throw new \LogicException('File inputs should be instances of FileFormField.');
}
$this->value = $this->node
->getAttribute('value');
}