You are here

public function AppForm::getEntityFromRouteMatch in Apigee Edge 8

Determines which entity will be used by this form from a RouteMatch object.

Parameters

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

string $entity_type_id: The entity type identifier.

Return value

\Drupal\Core\Entity\EntityInterface The entity object as determined from the passed-in route match.

Overrides EntityForm::getEntityFromRouteMatch

File

src/Entity/Form/AppForm.php, line 300

Class

AppForm
Base entity form for developer- and team (company) app create/edit forms.

Namespace

Drupal\apigee_edge\Entity\Form

Code

public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id) {

  // Always expect that the parameter in the route is not the entity type
  // (ex: {developer_app}) in case of apps rather just {app}.
  if ($route_match
    ->getRawParameter('app') !== NULL) {
    $entity = $route_match
      ->getParameter('app');
  }
  else {
    $entity = parent::getEntityFromRouteMatch($route_match, $entity_type_id);
  }
  return $entity;
}