You are here

views_complex_grouping.module in Views Complex Grouping 8

Same filename and directory in other branches
  1. 7 views_complex_grouping.module

Adds theme function for custom template.

File

views_complex_grouping.module
View source
<?php

/**
 * @file
 * Adds theme function for custom template.
 */
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_theme().
 */
function views_complex_grouping_theme($existing, $type, $theme, $path) {
  \Drupal::moduleHandler()
    ->loadInclude('views_complex_grouping', 'inc', 'views_complex_grouping.theme');
  return [
    'views_view_complex_grouping_level' => [
      'variables' => [
        'view' => NULL,
        'grouping' => NULL,
        'grouping_level' => NULL,
        'rows' => NULL,
        'title' => NULL,
        'fields' => NULL,
        'grouping_branch' => NULL,
      ],
      'file' => 'views_complex_grouping.theme.inc',
    ],
    'views_view_complex_grouping_leave' => [
      'variables' => [
        'view' => NULL,
        'grouping' => NULL,
        'grouping_level' => NULL,
        'rows' => NULL,
        'title' => NULL,
        'fields' => NULL,
        'grouping_branch' => NULL,
      ],
    ],
  ];
}

/**
 * Implements hook_help().
 */
function views_complex_grouping_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.views_complex_grouping':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Views Complex Grouping allows you to attach fields to a grouping field. There is currently no way using Views to attach fields on the same level as the group by fields. You can also limit the number of rows rendered for each grouping.') . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<p>' . t('The module has no menu or modifiable settings. There is no configuration. When enabled, Views will have a format Complex Grouping option. Configure the View format options to choose the items limit and offset, as well as to select the fields which will be displayed alongside the Grouping Field. Please note that in order for this to take effect, you must set the row limit on the View pager to Unlimited.') . '</p>';
      return $output;
  }
}

Functions