class BatchTestHelper

Hierarchy

Expanded class hierarchy of BatchTestHelper

8 files declare their use of BatchTestHelper
BatchTestChainedForm.php in core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php
BatchTestController.php in core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php
BatchTestMockForm.php in core/modules/system/tests/modules/batch_test/src/Form/BatchTestMockForm.php
BatchTestMultiStepForm.php in core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php
BatchTestSimpleForm.php in core/modules/system/tests/modules/batch_test/src/Form/BatchTestSimpleForm.php

... See full list

File

core/modules/system/tests/modules/batch_test/src/BatchTestHelper.php, line 9

Namespace

Drupal\batch_test
View source
class BatchTestHelper {
    
    /**
     * Batch operation: Submits form_test_mock_form().
     */
    public function nestedDrupalFormSubmitCallback($value) : void {
        $form_state = (new FormState())->setValue('test_value', $value);
        \Drupal::formBuilder()->submitForm('Drupal\\batch_test\\Form\\BatchTestMockForm', $form_state);
    }
    
    /**
     * Helper function: Stores or retrieves traced execution data.
     */
    public function stack($data = NULL, $reset = FALSE) : array|null {
        $state = \Drupal::state();
        if ($reset) {
            $state->delete('batch_test.stack');
        }
        if (!isset($data)) {
            return $state->get('batch_test.stack');
        }
        $stack = $state->get('batch_test.stack');
        $stack[] = $data;
        $state->set('batch_test.stack', $stack);
        return NULL;
    }

}

Members

Title Sort descending Modifiers Object type Summary
BatchTestHelper::nestedDrupalFormSubmitCallback public function Batch operation: Submits form_test_mock_form().
BatchTestHelper::stack public function Helper function: Stores or retrieves traced execution data.

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