You are here

function mixitup_views_filter_terms in MixItUp Views 7

Unset unneeded terms.

If all records share same terms (One or more). In that case it doesn't make sense to show all terms.

Parameters

array $terms: Terms array.

Return value

array $terms Filtered array of terms.

1 call to mixitup_views_filter_terms()
mixitup_views_filters_form in ./mixitup_views.module
Filters form.

File

./mixitup_views.module, line 346
Provides a Views style plugin for displaying content with Mixitup filtering.

Code

function mixitup_views_filter_terms(array $terms) {
  $node_filters =& drupal_static('mixitup_views_populate_node_filters');
  $nodes_count =& drupal_static('mixitup_views_set_nodes_count');
  if ($node_filters) {
    foreach ($node_filters as $tid => $nids) {
      if (count($nids) == $nodes_count) {
        unset($terms['.tid_' . $tid]);
      }
    }
  }
  return $terms;
}