You are here

public function SlickGrouping::render_grouping in Slick Views 7.3

Overrides StylePluginBase::renderGrouping().

Overrides views_plugin_style::render_grouping

File

src/Plugin/views/style/SlickGrouping.php, line 223

Class

SlickGrouping
Slick style plugin with grouping support.

Namespace

Drupal\slick_views\Plugin\views\style

Code

public function render_grouping($records, $groupings = [], $group_rendered = NULL) {
  $sets = parent::render_grouping($records, $groupings, $group_rendered);
  $grouping = empty($groupings) ? [] : array_filter($groupings);

  // Only add limits for the first top level grouping to avoid recursiveness.
  if (!empty($grouping) && !empty($this->options['grouping_limit'])) {
    $new_sets = array_values($sets);
    $sets = [];
    foreach ($new_sets as $set) {
      $set['rows'] = array_slice($set['rows'], 0, $this->options['grouping_limit'], TRUE);
      $sets[] = $set;
    }
  }
  return $sets;
}