function social_mentions_preprocess_mentions in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 8.2 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 8.3 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 8.4 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 8.5 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 8.6 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 8.7 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 8.8 modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 10.3.x modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 10.0.x modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 10.1.x modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
- 10.2.x modules/social_features/social_mentions/social_mentions.module \social_mentions_preprocess_mentions()
Implements hook_preprocess_hook().
File
- modules/
social_features/ social_mentions/ social_mentions.module, line 79 - Contains social_mentions.module.
Code
function social_mentions_preprocess_mentions(&$variables) {
if (!empty($variables['elements']['#mentions'])) {
$mention = $variables['elements']['#mentions'];
if (isset($mention->entity_type)) {
$entity_type = $mention
->getMentionedEntityTypeId();
$entity = $mention
->getMentionedEntity();
if ($entity) {
$content = \Drupal::entityTypeManager()
->getViewBuilder($entity_type)
->view($entity, 'activity');
$variables['mention_context'] = $content;
}
}
}
}