ah_toc.module 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. // $Id$
  3. /**
  4. * @file
  5. * Automatically adds a table of contents block on advanced_help pages.
  6. *
  7. * @copyright Ouest Systèmes Informatiques (OSInet)
  8. *
  9. * @license Licensed under the General Public License version 2 and later.
  10. */
  11. /**
  12. * Module name
  13. * @var string
  14. */
  15. define('AH_TOC_MODULE', 'ah_toc');
  16. /**
  17. * Implementation of hook_help().
  18. *
  19. * @return string
  20. */
  21. function ah_toc_help($section, $arg) {
  22. if ($section == 'admin/help#'. AH_TOC_MODULE) {
  23. $ret = t('The AH Table Of Contents module automatically builds a table of contents block on advanced_help pages. This building is done entirely client-side using jQuery.');
  24. }
  25. else {
  26. $ret = NULL;
  27. }
  28. return $ret;
  29. }
  30. /**
  31. * Implementation of hook_init().
  32. *
  33. * Add the AH TOC CSS and JS only on AH pages, and not on main AH index page.
  34. *
  35. * @return void
  36. */
  37. function ah_toc_init() {
  38. if (arg(0) != 'help') {
  39. return;
  40. }
  41. $path = drupal_get_path('module', AH_TOC_MODULE);
  42. drupal_add_js($path .'/'. AH_TOC_MODULE .'.js');
  43. drupal_add_css($path .'/'. AH_TOC_MODULE .'.css');
  44. }