protected function Subscriptions::hasSubscribableEntites in Message Subscribe 8
Determine if this entity has accessible entities to subscribe to.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to check for subscribable entities.
Return value
bool Returns TRUE if there are subscribable entites found.
1 call to Subscriptions::hasSubscribableEntites()
- Subscriptions::build in message_subscribe_ui/
src/ Plugin/ Block/ Subscriptions.php - Builds and returns the renderable array for this block plugin.
File
- message_subscribe_ui/
src/ Plugin/ Block/ Subscriptions.php, line 217
Class
- Subscriptions
- An entity subscriptions block.
Namespace
Drupal\message_subscribe_ui\Plugin\BlockCode
protected function hasSubscribableEntites(EntityInterface $entity) {
$entities = [
$entity,
];
$entities += $entity
->referencedEntities();
foreach ($entities as $referenced_entity) {
if ($referenced_entity
->access('view')) {
$flags = $this->subscribers
->getFlags($referenced_entity
->getEntityTypeId(), $referenced_entity
->bundle(), $this->currentUser);
if (!empty($flags)) {
return TRUE;
}
}
}
return FALSE;
}