function social_follow_tag_social_follow_taxonomy_terms_list_alter in Open Social 10.3.x
Same name and namespace in other branches
- 10.0.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/social_follow_tag.module \social_follow_tag_social_follow_taxonomy_terms_list_alter()
- 10.1.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/social_follow_tag.module \social_follow_tag_social_follow_taxonomy_terms_list_alter()
- 10.2.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/social_follow_tag.module \social_follow_tag_social_follow_taxonomy_terms_list_alter()
Implements hook_social_follow_taxonomy_terms_list_alter().
File
- modules/
social_features/ social_follow_taxonomy/ modules/ social_follow_tag/ social_follow_tag.module, line 47 - Contains social_follow_tag.module.
Code
function social_follow_tag_social_follow_taxonomy_terms_list_alter(array &$term_ids, $entity) {
/** @var \Drupal\node\Entity\Node $entity */
if ($entity instanceof NodeInterface && $entity
->hasField('social_tagging')) {
if (!empty($entity
->get('social_tagging')
->getValue())) {
$tags = $entity
->get('social_tagging')
->getValue();
foreach ($tags as $tag) {
$term_ids[] = $tag['target_id'];
}
}
}
return $term_ids;
}