public function MentionActivityContext::getMentionsFromRelatedEntity in Open Social 8.9
Same name and namespace in other branches
- 8 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8.2 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8.3 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8.4 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8.5 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8.6 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8.7 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8.8 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 10.3.x modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 10.0.x modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 10.1.x modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 10.2.x modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
Get the mentions from the related entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity object.
Return value
\Drupal\Core\Entity\EntityInterface[] The mentions.
2 calls to MentionActivityContext::getMentionsFromRelatedEntity()
- MentionActivityContext::getRecipients in modules/
social_features/ social_mentions/ src/ Plugin/ ActivityContext/ MentionActivityContext.php - Returns a batched list of recipients for this context.
- MentionActivityContext::isValidEntity in modules/
social_features/ social_mentions/ src/ Plugin/ ActivityContext/ MentionActivityContext.php - Check for valid entity.
File
- modules/
social_features/ social_mentions/ src/ Plugin/ ActivityContext/ MentionActivityContext.php, line 104
Class
- MentionActivityContext
- Provides a 'MentionActivityContext' activity context.
Namespace
Drupal\social_mentions\Plugin\ActivityContextCode
public function getMentionsFromRelatedEntity(EntityInterface $entity) {
if ($entity
->getEntityTypeId() === 'comment') {
if ($entity
->hasParentComment()) {
$entity = $entity
->getParentComment();
}
}
// Mention entity can't be loaded at time of new post or comment creation.
return $this->entityTypeManager
->getStorage('mentions')
->loadByProperties([
'entity_type' => $entity
->getEntityTypeId(),
'entity_id' => $entity
->id(),
]);
}