public function MentionActivityContext::getMentionsFromRelatedEntity in Open Social 8.2
Same name and namespace in other branches
- 8.9 modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php \Drupal\social_mentions\Plugin\ActivityContext\MentionActivityContext::getMentionsFromRelatedEntity()
- 8 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.
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 96
Class
- MentionActivityContext
- Provides a 'MentionActivityContext' activity context.
Namespace
Drupal\social_mentions\Plugin\ActivityContextCode
public function getMentionsFromRelatedEntity($entity) {
if ($entity
->getEntityTypeId() === 'comment') {
if ($entity
->getParentComment()) {
$entity = $entity
->getParentComment();
}
}
// Mention entity can't be loaded at time of new post or comment creation.
$mentions = \Drupal::entityTypeManager()
->getStorage('mentions')
->loadByProperties([
'entity_type' => $entity
->getEntityTypeId(),
'entity_id' => $entity
->id(),
]);
return $mentions;
}