You are here

public function AppRouteEnhancer::enhance in Apigee Edge 8

File

src/Entity/Enhancer/AppRouteEnhancer.php, line 42

Class

AppRouteEnhancer
Route enhancer for team apps.

Namespace

Drupal\apigee_edge\Entity\Enhancer

Code

public function enhance(array $defaults, Request $request) {

  // The {app} route parameter gets up-casted to an app entity
  // by app by name converters. For example: DeveloperAppNameConverter.
  // @see \Drupal\apigee_edge\ParamConverter\DeveloperAppNameConverter
  if (!isset($defaults['_entity']) && isset($defaults['app']) && is_object($defaults['app']) && $defaults['app'] instanceof AppInterface) {

    // Required by entity view controllers and title callbacks for example.
    // @see \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer::enhanceEntityView()
    // @see \Drupal\Core\Entity\Controller\EntityViewController::view()
    // @see \Drupal\Core\Entity\Controller\EntityController::doGetEntity()
    $defaults['_entity'] =& $defaults['app'];
  }
  return $defaults;
}