function EntityController::title

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/Controller/EntityController.php \Drupal\Core\Entity\Controller\EntityController::title()
  2. 8.9.x core/lib/Drupal/Core/Entity/Controller/EntityController.php \Drupal\Core\Entity\Controller\EntityController::title()
  3. 10 core/lib/Drupal/Core/Entity/Controller/EntityController.php \Drupal\Core\Entity\Controller\EntityController::title()

Provides a generic title callback for a single entity.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.

\Drupal\Core\Entity\EntityInterface $_entity: (optional) An entity, passed in directly from the request attributes.

Return value

string|null The title for the entity view page, if an entity was found.

3 string references to 'EntityController::title'
block_content.routing.yml in core/modules/block_content/block_content.routing.yml
core/modules/block_content/block_content.routing.yml
comment.routing.yml in core/modules/comment/comment.routing.yml
core/modules/comment/comment.routing.yml
node.routing.yml in core/modules/node/node.routing.yml
core/modules/node/node.routing.yml

File

core/lib/Drupal/Core/Entity/Controller/EntityController.php, line 264

Class

EntityController
Provides the add-page and title callbacks for entities.

Namespace

Drupal\Core\Entity\Controller

Code

public function title(RouteMatchInterface $route_match, ?EntityInterface $_entity = NULL) {
    if ($entity = $this->doGetEntity($route_match, $_entity)) {
        return $entity->label();
    }
}

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