private function getActivities($campaignId) {
    $activities = [];

    $categories = $this->getCategories($campaignId);

    foreach (array_keys($categories) as $categoryId) {
      $topTerm = $this->taxonomyStorage->load($categoryId);

      $terms = $this->taxonomyStorage->loadTree($topTerm->getVocabularyId(), $categoryId, 1, TRUE);
      /** @var \Drupal\taxonomy\Entity\Term $term */
      foreach ($terms as $term) {
        if (!$term->field_enable_activities_counter->value) {
          continue;
        }
        $activities[$term->id()] = $term->getName();
      }
    }
    asort($activities);

    return $activities;
  }
private function getActivities($campaignId) {
    $activities = [];

    $categories = $this->getCategories($campaignId);

    foreach (array_keys($categories) as $categoryId) {
      $topTerm = $this->taxonomyStorage->load($categoryId);

      $terms = $this->taxonomyStorage->loadTree($topTerm->getVocabularyId(), $categoryId, 1, TRUE);
      /** @var \Drupal\taxonomy\Entity\Term $term */
      foreach ($terms as $term) {
        if (!$term->field_enable_activities_counter->value) {
          continue;
        }
        $activities[$term->id()] = $term->getName();
      }
    }
    asort($activities);

    return $activities;
  }
private function getActivities ( $ campaignId ) { $ activities = [ ] ; $ categories = $ this -> getCategories ( $ campaignId ) ; foreach ( array_keys ( $ categories ) as $ categoryId ) { $ topTerm = $ this -> taxonomyStorage -> load ( $ categoryId ) ; $ terms = $ this -> taxonomyStorage -> loadTree ( $ topTerm -> getVocabularyId ( ) , $ categoryId , 1 , TRUE ) ; /** @var \Drupal\taxonomy\Entity\Term $term */ foreach ( $ terms as $ term ) { if ( ! $ term -> field_enable_activities_counter -> value ) { continue ; } $ activities [ $ term -> id ( ) ] = $ term -> getName ( ) ; } } asort ( $ activities ) ; return $ activities ; }
Get activities by the category.

@param int $campaignId

@return \Drupal\Core\Entity\EntityInterface[]
@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Get activities by the category .