W3cubDocs

/Drupal 8

protected function EntityListBuilder::getLabel

protected EntityListBuilder::getLabel(EntityInterface $entity)

Gets the label of an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity being listed.

Return value

string The entity label.

Deprecated

in Drupal 8.0.x, will be removed before Drupal 9.0.0 Use $entity->label() instead. This method used to escape the entity label. The render system's autoescape is now relied upon.

File

core/lib/Drupal/Core/Entity/EntityListBuilder.php, line 114

Class

EntityListBuilder
Defines a generic implementation to build a listing of entities.

Namespace

Drupal\Core\Entity

Code

protected function getLabel(EntityInterface $entity) {
  return $entity->label();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityListBuilder.php/function/EntityListBuilder::getLabel/8.1.x