function EntityListBuilder::getLabel

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.0 and is removed from 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 120

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();
}

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