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

Breadcrumb

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

function BrowserKitDriver::mergeForms

Merges second form values into first one.

Parameters

Form $to merging target:

Form $from merging source:

1 call to BrowserKitDriver::mergeForms()
BrowserKitDriver::submit in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 788

Class

BrowserKitDriver
Symfony BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

private function mergeForms(Form $to, Form $from) : void {
    foreach ($from->all() as $name => $field) {
        $fieldReflection = new \ReflectionObject($field);
        $nodeReflection = $fieldReflection->getProperty('node');
        $valueReflection = $fieldReflection->getProperty('value');
        $nodeReflection->setAccessible(true);
        $valueReflection->setAccessible(true);
        $isIgnoredField = $field instanceof InputFormField && in_array($nodeReflection->getValue($field)
            ->getAttribute('type'), array(
            'submit',
            'button',
            'image',
        ), true);
        if (!$isIgnoredField) {
            $targetField = $to[$name];
            \assert($targetField instanceof FormField);
            $valueReflection->setValue($targetField, $valueReflection->getValue($field));
        }
    }
}

API Navigation

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