You are here

public function Crawler::form in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Crawler.php \Symfony\Component\DomCrawler\Crawler::form()

Returns a Form object for the first node in the list.

Parameters

array $values An array of values for the form fields:

string $method The method for the form:

Return value

Form A Form instance

Throws

\InvalidArgumentException If the current node list is empty

File

vendor/symfony/dom-crawler/Crawler.php, line 738

Class

Crawler
Crawler eases navigation of a list of \DOMElement objects.

Namespace

Symfony\Component\DomCrawler

Code

public function form(array $values = null, $method = null) {
  if (!count($this)) {
    throw new \InvalidArgumentException('The current node list is empty.');
  }
  $form = new Form($this
    ->getNode(0), $this->uri, $method, $this->baseHref);
  if (null !== $values) {
    $form
      ->setValues($values);
  }
  return $form;
}