You are here

public function FormFieldRegistry::add in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dom-crawler/FormFieldRegistry.php \Symfony\Component\DomCrawler\FormFieldRegistry::add()

Adds a field to the registry.

Parameters

FormField $field The field:

Throws

\InvalidArgumentException when the name is malformed

File

vendor/symfony/dom-crawler/FormFieldRegistry.php, line 32

Class

FormFieldRegistry
This is an internal class that must not be used directly.

Namespace

Symfony\Component\DomCrawler

Code

public function add(FormField $field) {
  $segments = $this
    ->getSegments($field
    ->getName());
  $target =& $this->fields;
  while ($segments) {
    if (!is_array($target)) {
      $target = array();
    }
    $path = array_shift($segments);
    if ('' === $path) {
      $target =& $target[];
    }
    else {
      $target =& $target[$path];
    }
  }
  $target = $field;
}