function social_follow_taxonomy_term_followed in Open Social 10.0.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module \social_follow_taxonomy_term_followed()
- 10.1.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module \social_follow_taxonomy_term_followed()
- 10.2.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module \social_follow_taxonomy_term_followed()
Function to check if term is followed.
Parameters
\Drupal\taxonomy\TermInterface $term: Term entity.
Return value
bool Follow result.
4 calls to social_follow_taxonomy_term_followed()
- SocialFollowTagLazyBuilder::lazyBuild in modules/
social_features/ social_follow_taxonomy/ modules/ social_follow_tag/ src/ SocialFollowTagLazyBuilder.php - Returns tags for lazy builder.
- social_follow_tag_preprocess_social_tagging_nosplit in modules/
social_features/ social_follow_taxonomy/ modules/ social_follow_tag/ social_follow_tag.module - Extends variables for social_tagging_nosplit template.
- social_follow_tag_preprocess_social_tagging_split in modules/
social_features/ social_follow_taxonomy/ modules/ social_follow_tag/ social_follow_tag.module - Extends variables for social_tagging_split template.
- social_follow_taxonomy_tokens in modules/
social_features/ social_follow_taxonomy/ social_follow_taxonomy.module - Implements hook_tokens().
File
- modules/
social_features/ social_follow_taxonomy/ social_follow_taxonomy.module, line 362 - Contains social_follow_taxonomy.module.
Code
function social_follow_taxonomy_term_followed(TermInterface $term) {
$follow = FALSE;
if (!\Drupal::currentUser()
->isAnonymous()) {
$flag = Flag::load('follow_term');
if ($flag instanceof FlagInterface) {
/** @var \Drupal\flag\FlagService $service */
$service = \Drupal::service('flag');
if (!empty($service
->getFlagging($flag, $term, \Drupal::currentUser()))) {
$follow = TRUE;
}
}
}
return $follow;
}