function FormElementHelperTest::getElementTitleProvider

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php \Drupal\Tests\Core\Form\FormElementHelperTest::getElementTitleProvider()
  2. 10 core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php \Drupal\Tests\Core\Form\FormElementHelperTest::getElementTitleProvider()
  3. 11.x core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php \Drupal\Tests\Core\Form\FormElementHelperTest::getElementTitleProvider()

Provides test data.

File

core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php, line 118

Class

FormElementHelperTest
Tests the form element helper.

Namespace

Drupal\Tests\Core\Form

Code

public function getElementTitleProvider() {
    $data = [];
    $data[] = [
        'id',
        [],
        '',
    ];
    $data[] = [
        'id',
        [
            'id' => [
                '#title' => 'ID',
                '#parents' => [
                    'id',
                ],
            ],
        ],
        'ID',
    ];
    $data[] = [
        'id',
        [
            'fieldset' => [
                'id' => [
                    '#title' => 'ID',
                    '#parents' => [
                        'id',
                    ],
                ],
                '#parents' => [
                    'fieldset',
                ],
            ],
        ],
        'ID',
    ];
    $data[] = [
        'fieldset',
        [
            'fieldset' => [
                'id' => [
                    '#title' => 'ID',
                    '#parents' => [
                        'id',
                    ],
                ],
                '#parents' => [
                    'fieldset',
                ],
            ],
        ],
        'ID',
    ];
    $data[] = [
        'fieldset][id',
        [
            'fieldset' => [
                '#tree' => TRUE,
                'id' => [
                    '#title' => 'ID',
                    '#parents' => [
                        'fieldset',
                        'id',
                    ],
                ],
                '#parents' => [
                    'fieldset',
                ],
            ],
        ],
        'ID',
    ];
    return $data;
}

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