protected function Subscriptions::getCurrentEntity in Message Subscribe 8
Helper method to retrieve the current page entity.
Return value
\Drupal\Core\Entity\EntityInterface|null The entity for the current route.
2 calls to Subscriptions::getCurrentEntity()
- Subscriptions::build in message_subscribe_ui/
src/ Plugin/ Block/ Subscriptions.php - Builds and returns the renderable array for this block plugin.
- Subscriptions::buildForm in message_subscribe_ui/
src/ Plugin/ Block/ Subscriptions.php - Form constructor.
File
- message_subscribe_ui/
src/ Plugin/ Block/ Subscriptions.php, line 116
Class
- Subscriptions
- An entity subscriptions block.
Namespace
Drupal\message_subscribe_ui\Plugin\BlockCode
protected function getCurrentEntity() {
// Let's look up in the route object for the name of upcasted values.
foreach ($this->routeMatch
->getParameters() as $parameter) {
if ($parameter instanceof EntityInterface) {
return $parameter;
}
}
}