function BatchTestController::testProgrammatic

Same name in other branches
  1. 9 core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php \Drupal\batch_test\Controller\BatchTestController::testProgrammatic()
  2. 8.9.x core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php \Drupal\batch_test\Controller\BatchTestController::testProgrammatic()
  3. 11.x core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php \Drupal\batch_test\Controller\BatchTestController::testProgrammatic()

Submits the 'Chained' form programmatically.

Programmatic form: the page submits the 'Chained' form through \Drupal::formBuilder()->submitForm().

Parameters

int $value: Some value passed to a the chained form.

Return value

array Render array containing markup.

1 string reference to 'BatchTestController::testProgrammatic'
batch_test.routing.yml in core/modules/system/tests/modules/batch_test/batch_test.routing.yml
core/modules/system/tests/modules/batch_test/batch_test.routing.yml

File

core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php, line 98

Class

BatchTestController
Controller routines for batch tests.

Namespace

Drupal\batch_test\Controller

Code

public function testProgrammatic($value = 1) {
    $form_state = (new FormState())->setValues([
        'value' => $value,
    ]);
    \Drupal::formBuilder()->submitForm('Drupal\\batch_test\\Form\\BatchTestChainedForm', $form_state);
    return [
        'success' => [
            '#markup' => 'Got out of a programmatic batched form.',
        ],
    ];
}

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