You are here

public function FormElementHelperTest::getElementTitleProvider in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 123
Contains \Drupal\Tests\Core\Form\FormElementHelperTest.

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;
}