function EntityAutocompleteElementFormTest::getAutocompleteInput

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php \Drupal\KernelTests\Core\Entity\Element\EntityAutocompleteElementFormTest::getAutocompleteInput()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php \Drupal\KernelTests\Core\Entity\Element\EntityAutocompleteElementFormTest::getAutocompleteInput()
  3. 10 core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php \Drupal\KernelTests\Core\Entity\Element\EntityAutocompleteElementFormTest::getAutocompleteInput()

Returns an entity label in 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.

2 calls to EntityAutocompleteElementFormTest::getAutocompleteInput()
EntityAutocompleteElementFormTest::testEntityAutocompleteIdInput in core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
Tests ID input is handled correctly.
EntityAutocompleteElementFormTest::testValidEntityAutocompleteElement in core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
Tests valid entries in the EntityAutocomplete Form API element.

File

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

Class

EntityAutocompleteElementFormTest
Tests the EntityAutocomplete Form API element.

Namespace

Drupal\KernelTests\Core\Entity\Element

Code

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

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