function activity_creator_entity_view in Open Social 8.9
Same name and namespace in other branches
- 8 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 8.2 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 8.3 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 8.4 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 8.5 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 8.6 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 8.7 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 8.8 modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 10.3.x modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 10.0.x modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 10.1.x modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
- 10.2.x modules/custom/activity_creator/activity_creator.module \activity_creator_entity_view()
Implements hook_entity_view().
Mark notifications as read.
File
- modules/
custom/ activity_creator/ activity_creator.module, line 261 - Activity Creator module file.
Code
function activity_creator_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
// Generate the output text for the user in it's selected language.
if ($entity instanceof Activity && !empty($entity
->get('field_activity_message')->target_id)) {
$message = Message::load($entity
->get('field_activity_message')->target_id);
if ($message instanceof Message) {
// Get the text in the users language.
$output = \Drupal::service('activity_creator.activity_factory')
->getMessageText($message);
// Replace the old text with the correct one.
$build['field_activity_output_text'][0]['#text'] = $output[0];
}
}
}