abstract class FormField in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dom-crawler/Field/FormField.php \Symfony\Component\DomCrawler\Field\FormField
FormField is the abstract class for all form fields.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\DomCrawler\Field\FormField
Expanded class hierarchy of FormField
3 files declare their use of FormField
- BrowserKitDriver.php in vendor/behat/ mink-browserkit-driver/ src/ BrowserKitDriver.php 
- Form.php in vendor/symfony/ dom-crawler/ Form.php 
- FormFieldRegistry.php in vendor/symfony/ dom-crawler/ FormFieldRegistry.php 
File
- vendor/symfony/ dom-crawler/ Field/ FormField.php, line 19 
Namespace
Symfony\Component\DomCrawler\FieldView source
abstract class FormField {
  /**
   * @var \DOMElement
   */
  protected $node;
  /**
   * @var string
   */
  protected $name;
  /**
   * @var string
   */
  protected $value;
  /**
   * @var \DOMDocument
   */
  protected $document;
  /**
   * @var \DOMXPath
   */
  protected $xpath;
  /**
   * @var bool
   */
  protected $disabled;
  /**
   * Constructor.
   *
   * @param \DOMElement $node The node associated with this field
   */
  public function __construct(\DOMElement $node) {
    $this->node = $node;
    $this->name = $node
      ->getAttribute('name');
    $this->xpath = new \DOMXPath($node->ownerDocument);
    $this
      ->initialize();
  }
  /**
   * Returns the name of the field.
   *
   * @return string The name of the field
   */
  public function getName() {
    return $this->name;
  }
  /**
   * Gets the value of the field.
   *
   * @return string|array The value of the field
   */
  public function getValue() {
    return $this->value;
  }
  /**
   * Sets the value of the field.
   *
   * @param string $value The value of the field
   */
  public function setValue($value) {
    $this->value = (string) $value;
  }
  /**
   * Returns true if the field should be included in the submitted values.
   *
   * @return bool true if the field should be included in the submitted values, false otherwise
   */
  public function hasValue() {
    return true;
  }
  /**
   * Check if the current field is disabled.
   *
   * @return bool
   */
  public function isDisabled() {
    return $this->node
      ->hasAttribute('disabled');
  }
  /**
   * Initializes the form field.
   */
  protected abstract function initialize();
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| FormField:: | protected | property | ||
| FormField:: | protected | property | ||
| FormField:: | protected | property | ||
| FormField:: | protected | property | ||
| FormField:: | protected | property | ||
| FormField:: | protected | property | ||
| FormField:: | public | function | Returns the name of the field. | |
| FormField:: | public | function | Gets the value of the field. | |
| FormField:: | public | function | Returns true if the field should be included in the submitted values. | 1 | 
| FormField:: | abstract protected | function | Initializes the form field. | 4 | 
| FormField:: | public | function | Check if the current field is disabled. | 1 | 
| FormField:: | public | function | Sets the value of the field. | 2 | 
| FormField:: | public | function | Constructor. | 
