function Callbacks::tableselectGetData

Create a header and options array. Helper function for callbacks.

4 calls to Callbacks::tableselectGetData()
ElementsTableSelectTest::testMultipleFalseOptionChecker in core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php
Tests error handling for invalid tableselect values with radio buttons.
ElementsTableSelectTest::testMultipleTrueOptionChecker in core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php
Tests error handling for invalid tableselect values with checkboxes.
FormTestTableSelectColspanForm::buildForm in core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectColspanForm.php
Form constructor.
FormTestTableSelectFormBase::tableselectFormBuilder in core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php
Build a form to test the tableselect element.

File

core/modules/system/tests/modules/form_test/src/Callbacks.php, line 56

Class

Callbacks
Simple class for testing methods as Form API callbacks.

Namespace

Drupal\form_test

Code

public static function tableselectGetData() : array {
    $header = [
        'one' => t('One'),
        'two' => t('Two'),
        'three' => t('Three'),
        'four' => t('Four'),
    ];
    $options['row1'] = [
        'title' => [
            'data' => [
                '#title' => t('row1'),
            ],
        ],
        'one' => 'row1col1',
        'two' => t('row1col2'),
        'three' => t('row1col3'),
        'four' => t('row1col4'),
    ];
    $options['row2'] = [
        'title' => [
            'data' => [
                '#title' => t('row2'),
            ],
        ],
        'one' => 'row2col1',
        'two' => t('row2col2'),
        'three' => t('row2col3'),
        'four' => t('row2col4'),
    ];
    $options['row3'] = [
        'title' => [
            'data' => [
                '#title' => t('row3'),
            ],
        ],
        'one' => 'row3col1',
        'two' => t('row3col2'),
        'three' => t('row3col3'),
        'four' => t('row3col4'),
    ];
    return [
        $header,
        $options,
    ];
}

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