You are here

public function EdgeEntityTitleProvider::title in Apigee Edge 8

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.

Overrides EntityController::title

File

src/Entity/EdgeEntityTitleProvider.php, line 35

Class

EdgeEntityTitleProvider
Provides default page titles for Apigee Edge entities.

Namespace

Drupal\apigee_edge\Entity

Code

public function title(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
  if ($entity = $this
    ->doGetEntity($route_match, $_entity)) {
    return $this
      ->t('@label @entity_type', [
      '@label' => $entity
        ->label(),
      '@entity_type' => mb_strtolower($this->entityTypeManager
        ->getDefinition($entity
        ->getEntityTypeId())
        ->getSingularLabel()),
    ]);
  }
  return parent::title($route_match, $_entity);
}