function social_group_preprocess_profile in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 8.2 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 8.3 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 8.4 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 8.5 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 8.6 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 8.7 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 8.8 modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 10.3.x modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 10.0.x modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 10.1.x modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
- 10.2.x modules/social_features/social_group/social_group.module \social_group_preprocess_profile()
Implements hook_preprocess_HOOK().
File
- modules/
social_features/ social_group/ social_group.module, line 977 - The Social group module.
Code
function social_group_preprocess_profile(&$variables) {
$group = _social_group_get_current_group();
if ($group instanceof Group && $variables['elements']['#view_mode'] == 'teaser') {
$account = $variables['elements']['#profile']
->get('uid')->entity;
if (!($member = $group
->getMember($account))) {
return;
}
$roles = $member
->getRoles();
if (isset($roles[$group
->bundle() . '-group_manager'])) {
$variables['badges'] = [
[
'label' => t('Group manager'),
'classes' => [
'badge-secondary teaser__badge',
],
],
];
}
}
}