function FormTestBase::getInfo

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

A stub method returning properties for the defined element type.

Parameters

string $type: The machine name of an element type plugin.

Return value

array An array with dummy values to be used in tests. Defaults to an empty array.

File

core/tests/Drupal/Tests/Core/Form/FormTestBase.php, line 289

Class

FormTestBase
Provides a base class for testing form functionality.

Namespace

Drupal\Tests\Core\Form

Code

public function getInfo($type) {
    $types['hidden'] = [
        '#input' => TRUE,
    ];
    $types['token'] = [
        '#input' => TRUE,
    ];
    $types['value'] = [
        '#input' => TRUE,
    ];
    $types['radios'] = [
        '#input' => TRUE,
    ];
    $types['textfield'] = [
        '#input' => TRUE,
    ];
    $types['submit'] = [
        '#input' => TRUE,
        '#name' => 'op',
        '#is_button' => TRUE,
    ];
    if (!isset($types[$type])) {
        $types[$type] = [];
    }
    return $types[$type];
}

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