You are here

function social_follow_taxonomy_flag_link in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.0.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module \social_follow_taxonomy_flag_link()
  2. 10.1.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module \social_follow_taxonomy_flag_link()
  3. 10.2.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module \social_follow_taxonomy_flag_link()

A function that prepares a flag link for a taxonomy term.

Parameters

\Drupal\taxonomy\TermInterface $term: Term entity.

Return value

string Link button to flag/unflag current term.

4 calls to social_follow_taxonomy_flag_link()
SocialFollowTagLazyBuilder::lazyBuild in modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/SocialFollowTagLazyBuilder.php
Returns tags for lazy builder.
SocialFollowTagLazyBuilder::popupLazyBuild in modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/SocialFollowTagLazyBuilder.php
Returns render array for tag follow popup.
social_follow_landing_page_preprocess_paragraph in modules/social_features/social_follow_taxonomy/modules/social_follow_landing_page/social_follow_landing_page.module
Implements hook_preprocess_HOOK().
social_follow_taxonomy_preprocess_activity in modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module
Extends variables for activity template.

File

modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module, line 410
Contains social_follow_taxonomy.module.

Code

function social_follow_taxonomy_flag_link(TermInterface $term) {
  $flag_link = '';
  if (!\Drupal::currentUser()
    ->isAnonymous()) {
    $flag_link_service = \Drupal::service('flag.link_builder');
    $flag_link = $flag_link_service
      ->build($term
      ->getEntityTypeId(), $term
      ->id(), 'follow_term');
  }
  return $flag_link;
}