You are here

README.txt in Views Summarize 7.2

Same filename and directory in other branches
  1. 7 README.txt
  2. 1.1.x README.txt

Demonstrates adding a summery for Views Summarize to use.

File

README.txt
View source
  1. CONTENTS OF THIS FILE
  2. ---------------------
  3. * Introduction
  4. * Requirements
  5. * Installation
  6. * Configuration
  7. * Extending
  8. * Maintainers
  9. INTRODUCTION
  10. ------------
  11. The Views Summarize module enables an extra display style which displays
  12. summaries of a column on the last row.
  13. * To submit bug reports and feature suggestions, or track changes:
  14. https://www.drupal.org/project/issues/views_summarize
  15. REQUIREMENTS
  16. ------------
  17. This module requires the following modules:
  18. * Views (https://www.drupal.org/project/views)
  19. INSTALLATION
  20. ------------
  21. * Install as you would normally install a contributed Drupal module. Visit
  22. https://www.drupal.org/node/895232/ for further information.
  23. CONFIGURATION
  24. -------------
  25. This module does not itself have configuration, but each Views display you
  26. create that uses the Summarized table display style does. Add and configure the
  27. fields you want to display, then click the "settings" link for the Summarized
  28. table format.
  29. On the popup form will be six columns that relate to this module:
  30. * Summarize prefix: One or more characters to display before the summary, like
  31. a currency symbol
  32. * Summarize: Specify which summary handler to use for the field
  33. * Summarize suffix: One or more characters to display after the summary, like a
  34. currency abbreviation
  35. * Summarize thousand: The character to use as a thousand separator
  36. * Summarize decimal: The character to use as a thousand separator
  37. * Summarize precision: The number of characters to place after the decimal
  38. separator
  39. Also on that form, toward the bottom of the form, is the "Display the summary
  40. row only" setting. Checking that box means that the data that is being
  41. summarized will not be displayed.
  42. EXTENDING
  43. ---------
  44. It is possible to extend this module by specifying your own summaries.
  45. 1. Implement hook_views_summarize_handlers() to add your summary to the list of
  46. possible handlers.
  47. 2. Implement hook_theme() to specify the function to use to theme the summary.
  48. 3. Create your theme function to create the output.
  49. Here is example code that could be placed in a .module file to add a summary
  50. that totals the records and displays the total as hours and minutes:
  51. /**
  52. * @file
  53. * Demonstrates adding a summery for Views Summarize to use.
  54. */
  55. /**
  56. * Implements hook_views_summarize_handlers().
  57. */
  58. function my_module_views_summarize_handlers() {
  59. return array(
  60. 'my_module_views_summarize_hours_min' => t('Hours and Minutes'),
  61. );
  62. }
  63. /*
  64. * Implements hook_theme().
  65. */
  66. function my_module_theme() {
  67. return array(
  68. 'my_module_views_summarize_hours_min' => array(
  69. 'variables' => array('data' => array()),
  70. ),
  71. );
  72. }
  73. /**
  74. * Themes data as hours and minutes.
  75. */
  76. function theme_my_module_views_summarize_hours_min($variables) {
  77. $data = $variables['data'];
  78. return '
    ' . format_interval(array_sum($data),2) . '
    ';
  79. }
  80. MAINTAINERS
  81. -----------
  82. Current maintainers:
  83. * Aidan Lister (aidanlis) - https://www.drupal.org/u/aidanlis
  84. * Jason Flatt (oadaeh) - https://www.drupal.org/u/oadaeh