You are here

protected function AppTitleProvider::doGetEntity in Apigee Edge 8

Determines the entity.

Parameters

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

\Drupal\Core\Entity\EntityInterface $_entity: (optional) The entity, set in \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity, if it is passed in directly or if the first parameter of the active route is an entity; otherwise, NULL.

Overrides EntityController::doGetEntity

1 call to AppTitleProvider::doGetEntity()
AppTitleProvider::analyticsTitle in src/Entity/AppTitleProvider.php
Provides a title for the app analytics page.

File

src/Entity/AppTitleProvider.php, line 54

Class

AppTitleProvider
Developer- and company (team) app specific title overrides and additions.

Namespace

Drupal\apigee_edge\Entity

Code

protected function doGetEntity(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
  if ($_entity) {
    $entity = $_entity;
  }
  else {

    // Let's look up in the route object for apps only.
    foreach ($route_match
      ->getParameters() as $parameter) {
      if ($parameter instanceof AppInterface) {
        $entity = $parameter;
        break;
      }
    }
  }
  if (isset($entity)) {
    return $this->entityRepository
      ->getTranslationFromContext($entity);
  }
}