You are here

alpha_pagination.module in Views Alpha Pagination 7

Same filename and directory in other branches
  1. 8.2 alpha_pagination.module
  2. 7.2 alpha_pagination.module

Controls access to our view and administrative settings.

@author Michael R. Bagnall (@mbagnall17) @version 1.0 @copyright 2015 FlyingFlip Studios, LLC. (@flyingflip) @link http://www.michaelbagnall.com

@license Copyright (c) 2015 FlyingFlip Studios, LLC. This software is open-source licensed under the GNU Public License Version 2 or later The full license is available in the LICENSE.TXT file at the root of this repository

File

alpha_pagination.module
View source
<?php

/**
 * @file
 * Controls access to our view and administrative settings.
 *
 * @author Michael R. Bagnall (@mbagnall17)
 * @version 1.0
 * @copyright 2015 FlyingFlip Studios, LLC. (@flyingflip)
 * @link http://www.michaelbagnall.com
 *
 * @license
 * Copyright (c) 2015 FlyingFlip Studios, LLC.
 * This software is open-source licensed under the GNU Public License Version 2 or later
 * The full license is available in the LICENSE.TXT file at the root of this repository
 */

/**
 * Implements hook_views_api().
 */
function alpha_pagination_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'alpha_pagination') . '/views',
  );
}

/**
 * Implements hook_library().
 */
function alpha_pagination_library() {
  $libraries['alpha_pagination'] = array(
    'title' => 'Views Alpha Pagination',
    'website' => 'https://www.drupal.org/project/alpha_pagination',
    'css' => array(
      drupal_get_path('module', 'alpha_pagination') . '/css/alpha_pagination.css' => array(),
    ),
  );
  return $libraries;
}

/**
 * Implements hook_node_presave().
 */
function alpha_pagination_node_presave($entity) {
  cache_clear_all('alpha_pagination:*', 'cache', TRUE);
}

/**
 * Implements hook_help().
 */
function alpha_pagination_help($path, $arg) {
  $output = NULL;
  switch ($path) {
    case 'admin/help#alpha_pagination':
      $output .= '<h4>' . t('Overview') . '</h4>';
      $output .= t('The Alpha Pagination for Views module enables you to add an alphabetical menu in the header or footer of a views display.');
      $output .= '<div style="border-top: 2px solid #f8981d; margin: 15px 0px; width: 100%"></div>';
      $output .= '<b>' . t('Views Integration and Configuration') . '</b>';
      $output .= '<ol>';
      $output .= '<li>' . t('Build a new view of either users, content (nodes), or comments.') . '</li>';
      $output .= '<li>' . t('Add whatever field you want to use as the basis for the alphabetic grouping (e.g. title, body). You can optionally exclude this field from display if you don\'t want it to appear in the results shown on the page for some reason. You can only choose a field that is a textfield, textarea or a textarea with a summary.') . '</li>';
      $output .= '<li>' . t('Add either a header or a footer to your view. Select the new item available in the menu of options for Global: Alpha Pagination.') . '</li>';
      $output .= '<li>' . t('Configure how you want alpha_pagination to work and specify where it should appear:');
      $output .= '<ol style="list-style-type: lower-alpha;">';
      $output .= '<li>' . t('set the path to the results view page.') . '</li>';
      $output .= '<li>' . t('select the field you want to use as the basis for the alphabetic grouping from the options presented in the select list (note: if the field you want to use does not appear, go back and add it to your view and then return to this configuration page to select the field).') . '</li>';
      $output .= '<li>' . t('add a context that is the same as the field you wish to use as the basis for alphabetic sorting. Be sure to enable Glossary mode and set the character limit to 1. The transform case option on the URL should be set to Upper Case.') . '</li>';
      $output .= '<li>' . t('by default the alpha pagination will apply to all displays; if you only want the alpha pagination to appear on the current display, use the drop-down menu at the top of the administrative interface to change the setting from "All displays" to "This page (override)".') . '</li>';
      $output .= '</ol>';
      $output .= '<li>' . t('An optional sample view is included and can be enabled via the alpha_pagination_example view. The sample relies on the \'article\' default content type. You can create sample content using the devel module or rely on your own data.') . '</li>';
      $output .= '</ol>';
      $output .= '<div style="border-top: 2px solid #f8981d; margin: 15px 0px; width: 100%"></div>';
      $output .= '<h4>' . t('Additional Style Optiona') . '</h4>';
      $output .= t('In addition, you can specify the CSS style classes around the paginator, the item list and each item whether or not it is active or inactive. This includes the ability to set a class for linked items (as opposed to items to which have no options and therefor no links).') . '<br /><br />';
      $output .= t('Furthermore, you can add an "ALL" item as well as numeric items and specify their positions in navigation, the label and their respective css class as well.');
      $output .= '<div style="border-top: 2px solid #f8981d; margin: 15px 0px; padding-top: 15px; width: 100%; font-size: 8pt; line-height: 1.3em;">';
      $output .= '<img src="/' . drupal_get_path('module', 'alpha_pagination') . '/images/flyingflip-logo.png" width="151" height="50" alt="FlyingFlip Studios" align="right" /><br />';
      $output .= 'Released 2016 - v7.x-1.x - FlyingFlip Studios, LLC. - Released under GNU GENERAL PUBLIC LICENSE - Version 2, June 1991<br />http://www.flyingflip.com - @flyingflip - @mbagnall17<br clear="right">';
      $output .= '<style>.item-list, hr { display: none; }</style></div>';
      break;
    default:
      break;
  }
  return $output;
}