You are here

class InputFormField in Zircon Profile 8.0

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

Expanded class hierarchy of InputFormField

3 files declare their use of InputFormField
BrowserKitDriver.php in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
FormFieldTest.php in vendor/symfony/dom-crawler/Tests/Field/FormFieldTest.php
InputFormFieldTest.php in vendor/symfony/dom-crawler/Tests/Field/InputFormFieldTest.php
1 string reference to 'InputFormField'
FormTest::provideInitializeValues in vendor/symfony/dom-crawler/Tests/FormTest.php

File

vendor/symfony/dom-crawler/Field/InputFormField.php, line 22

Namespace

Symfony\Component\DomCrawler\Field
View source
class InputFormField extends FormField {

  /**
   * Initializes the form field.
   *
   * @throws \LogicException When node type is incorrect
   */
  protected function initialize() {
    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));
    }
    if ('checkbox' === strtolower($this->node
      ->getAttribute('type'))) {
      throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
    }
    if ('file' === strtolower($this->node
      ->getAttribute('type'))) {
      throw new \LogicException('File inputs should be instances of FileFormField.');
    }
    $this->value = $this->node
      ->getAttribute('value');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FormField::$disabled protected property
FormField::$document protected property
FormField::$name protected property
FormField::$node protected property
FormField::$value protected property
FormField::$xpath protected property
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 Constructor.
InputFormField::initialize protected function Initializes the form field. Overrides FormField::initialize