You are here

public function ListUsageController::getTitle in Entity Usage 8

Same name and namespace in other branches
  1. 8.4 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::getTitle()
  2. 8.2 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::getTitle()
  3. 8.3 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::getTitle()

Title page callback.

Parameters

string $type: The entity type.

int $id: The entity id.

Return value

string The title to be used on this page.

1 call to ListUsageController::getTitle()
LocalTaskUsageController::getTitleLocalTask in src/Controller/LocalTaskUsageController.php
Title page callback.
1 string reference to 'ListUsageController::getTitle'
entity_usage.routing.yml in ./entity_usage.routing.yml
entity_usage.routing.yml

File

src/Controller/ListUsageController.php, line 132

Class

ListUsageController
Controller for our pages.

Namespace

Drupal\entity_usage\Controller

Code

public function getTitle($type, $id) {
  $entity = $this->entityTypeManager
    ->getStorage($type)
    ->load($id);
  if ($entity) {
    return $this
      ->t('Entity usage information for %entity_label', [
      '%entity_label' => $entity
        ->label(),
    ]);
  }
  else {
    return $this
      ->t('Entity Usage List');
  }
}