function social_tagging_preprocess_profile in Open Social 10.2.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_tagging/social_tagging.module \social_tagging_preprocess_profile()
- 10.0.x modules/social_features/social_tagging/social_tagging.module \social_tagging_preprocess_profile()
- 10.1.x modules/social_features/social_tagging/social_tagging.module \social_tagging_preprocess_profile()
Implements hook_preprocess_profile().
File
- modules/
social_features/ social_tagging/ social_tagging.module, line 561 - Contains social_tagging.module.
Code
function social_tagging_preprocess_profile(array &$variables) {
/** @var \Drupal\social_tagging\SocialTaggingService $tag_service */
$tag_service = \Drupal::service('social_tagging.tag_service');
$variables['social_tagging_profile_active'] = FALSE;
if ($tag_service
->active() && $tag_service
->profileActive()) {
$variables['social_tagging_profile_active'] = TRUE;
/** @var \Drupal\profile\Entity\ProfileInterface $profile */
$profile = $variables['profile'];
if (!$profile
->get('social_tagging')
->isEmpty()) {
$tags = $profile
->get('social_tagging')
->getValue();
$variables['social_tagging_allow_split'] = $tag_service
->allowSplit();
$variables['social_tagging_hierarchy'] = $tag_service
->buildHierarchy($tags, 'profile');
}
}
}