Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Form.php

function Form::getPhpValues

Gets the field values as PHP.

This method converts fields with the array notation (like foo[bar] to arrays) like PHP does.

File

vendor/symfony/dom-crawler/Form.php, line 121

Class

Form
Form represents an HTML form.

Namespace

Symfony\Component\DomCrawler

Code

public function getPhpValues() : array {
    $values = [];
    foreach ($this->getValues() as $name => $value) {
        $qs = http_build_query([
            $name => $value,
        ], '', '&');
        if ($qs) {
            parse_str($qs, $expandedValue);
            $varName = substr($name, 0, \strlen(key($expandedValue)));
            $values[] = [
                $varName => current($expandedValue),
            ];
        }
    }
    return array_replace_recursive([], ...$values);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal