public function ServiceResourceDeleteForm::getEntityFromRouteMatch in Services 9.0.x
Same name and namespace in other branches
- 8.4 src/Form/ServiceResourceDeleteForm.php \Drupal\services\Form\ServiceResourceDeleteForm::getEntityFromRouteMatch()
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/
Form/ ServiceResourceDeleteForm.php, line 55
Class
Namespace
Drupal\services\FormCode
public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id) {
if ($route_match
->getRawParameter('service_endpoint') !== NULL && $route_match
->getRawParameter('plugin_id') !== NULL) {
$service_endpoint = $route_match
->getParameter('service_endpoint');
$entity = $service_endpoint
->loadResourceProvider($route_match
->getRawParameter('plugin_id'));
}
if (!isset($entity) || FALSE === $entity) {
$entity = $this->entityTypeManager
->getStorage($entity_type_id)
->create([]);
}
return $entity;
}