protected function ConnectionAccessCheck::getEntity in RedHen CRM 8
Get the RedHen entity object from the given route.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The parameterized route.
Return value
\Drupal\Core\Entity\EntityInterface|null The entity object or NULL if there is no RedHen parameter in the route.
1 call to ConnectionAccessCheck::getEntity()
- ConnectionAccessCheck::access in modules/
redhen_connection/ src/ Access/ ConnectionAccessCheck.php - Checks access to the RedHen operation on the given route.
File
- modules/
redhen_connection/ src/ Access/ ConnectionAccessCheck.php, line 62
Class
Namespace
Drupal\redhen_connection\AccessCode
protected function getEntity(RouteMatchInterface $route_match) {
$connection = $route_match
->getParameter('redhen_connection');
if ($connection) {
if ($connection instanceof ConnectionInterface) {
return $connection;
}
return Connection::load($connection);
}
$contact = $route_match
->getParameter('redhen_contact');
if ($contact) {
if ($contact instanceof ContactInterface) {
return $contact;
}
return Contact::load($contact);
}
$org = $route_match
->getParameter('redhen_org');
if ($org) {
if ($org instanceof OrgInterface) {
return $org;
}
return Org::load($org);
}
return NULL;
}