function FormTestController::buttonWithFormAttribute

Returns a form and a button that has the form attribute.

Return value

array A render array containing the form and the button.

1 string reference to 'FormTestController::buttonWithFormAttribute'
form_test.routing.yml in core/modules/system/tests/modules/form_test/form_test.routing.yml
core/modules/system/tests/modules/form_test/form_test.routing.yml

File

core/modules/system/tests/modules/form_test/src/Controller/FormTestController.php, line 67

Class

FormTestController
Controller routines for form_test routes.

Namespace

Drupal\form_test\Controller

Code

public function buttonWithFormAttribute() : array {
  $return['form'] = $this->formBuilder()
    ->getForm(FormTestObject::class);
  $return['button'] = [
    '#type' => 'submit',
    '#value' => 'Attribute Button',
    '#attributes' => [
      'form' => 'form-test-form-test-object',
    ],
  ];
  return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.