function social_group_invite_preprocess_activity in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \social_group_invite_preprocess_activity()
- 10.3.x modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \social_group_invite_preprocess_activity()
- 10.1.x modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \social_group_invite_preprocess_activity()
- 10.2.x modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \social_group_invite_preprocess_activity()
Implements hook_preprocess_activity().
File
- modules/
social_features/ social_group/ modules/ social_group_invite/ social_group_invite.module, line 419 - The Social Invite group module.
Code
function social_group_invite_preprocess_activity(&$variables) {
$activity = $variables['elements']['#activity'];
$related_entity = $activity
->getRelatedEntity();
// If the related entity is a piece of GroupContent and coming from the
// ginvite group_invitation plugin, lets link the entity to the group itself.
if (!empty($related_entity) && $related_entity instanceof GroupContent && $related_entity
->getGroupContentType()
->getContentPluginId() === 'group_invitation') {
$group = $related_entity
->getGroup();
if ($group instanceof GroupInterface) {
$variables['full_url'] = $group
->toUrl('canonical');
}
}
}