You are here

function hook_social_follow_taxonomy_related_items_alter 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.api.php \hook_social_follow_taxonomy_related_items_alter()
  2. 10.1.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.api.php \hook_social_follow_taxonomy_related_items_alter()
  3. 10.2.x modules/social_features/social_follow_taxonomy/social_follow_taxonomy.api.php \hook_social_follow_taxonomy_related_items_alter()

Provide a method to alter array of related items.

Parameters

array $items: The input array of related entities.

\Drupal\taxonomy\TermInterface $term: Related taxonomy term.

Return value

array Extended array of related entities.

1 invocation of hook_social_follow_taxonomy_related_items_alter()
social_follow_taxonomy_related_entity_count in modules/social_features/social_follow_taxonomy/social_follow_taxonomy.module
Function for counting the number of nodes related to the term.

File

modules/social_features/social_follow_taxonomy/social_follow_taxonomy.api.php, line 54
Hooks provided by the Social Follow Taxonomy Term module.

Code

function hook_social_follow_taxonomy_related_items_alter(array &$items, TermInterface $term) {
  $items = \Drupal::entityTypeManager()
    ->getStorage('node')
    ->getQuery()
    ->condition('field_terms', $term
    ->id())
    ->execute();
  return $items;
}