class InputFormField
InputFormField represents an input form field (an HTML input tag).
For inputs with type of file, checkbox, or radio, there are other more specialized classes (cf. FileFormField and ChoiceFormField).
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\DomCrawler\Field\FormField
- class \Symfony\Component\DomCrawler\Field\InputFormField extends \Symfony\Component\DomCrawler\Field\FormField
Expanded class hierarchy of InputFormField
1 file declares its use of InputFormField
- BrowserKitDriver.php in vendor/
behat/ mink-browserkit-driver/ src/ BrowserKitDriver.php
File
-
vendor/
symfony/ dom-crawler/ Field/ InputFormField.php, line 22
Namespace
Symfony\Component\DomCrawler\FieldView source
class InputFormField extends FormField {
/**
* Initializes the form field.
*
* @throws \LogicException When node type is incorrect
*/
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');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
FormField::$disabled | protected | property | |||
FormField::$document | protected | property | |||
FormField::$name | protected | property | |||
FormField::$value | protected | property | |||
FormField::$xpath | protected | property | |||
FormField::getLabel | public | function | Returns the label tag associated to the field or null if none. | ||
FormField::getName | public | function | Returns the name of the field. | ||
FormField::getValue | public | function | Gets the value of the field. | ||
FormField::hasValue | public | function | Returns true if the field should be included in the submitted values. | 1 | |
FormField::isDisabled | public | function | Check if the current field is disabled. | 1 | |
FormField::setValue | public | function | Sets the value of the field. | 2 | |
FormField::__construct | public | function | |||
InputFormField::initialize | protected | function | Initializes the form field. | Overrides FormField::initialize |