You are here

protected function EntityAutocompleteElementFormTest::getAutocompleteInput in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php \Drupal\KernelTests\Core\Entity\Element\EntityAutocompleteElementFormTest::getAutocompleteInput()
  2. 9 core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php \Drupal\KernelTests\Core\Entity\Element\EntityAutocompleteElementFormTest::getAutocompleteInput()

Returns an entity label in the format needed by the EntityAutocomplete element.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: A Drupal entity.

Return value

string A string that can be used as a value for EntityAutocomplete elements.

File

core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php, line 394

Class

EntityAutocompleteElementFormTest
Tests the EntityAutocomplete Form API element.

Namespace

Drupal\KernelTests\Core\Entity\Element

Code

protected function getAutocompleteInput(EntityInterface $entity) {
  return EntityAutocomplete::getEntityLabels([
    $entity,
  ]);
}