You are here

public function FormTestBase::getInfo in Drupal 8

Same name and namespace in other branches
  1. 9 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];
}