drupal_module__ah_toc/ah_toc.module
FGM d1334aaa46 Initial version of AH TOC: build a static table of contents.
- do not add anchors to headings or link to them
- do not add "top" links to headings
- force code/pre in help pages to clear: right to avoid the TOC running into them.
- TODO: use a theme function to format the TOC
- TOTO: include a fold/unfold link on the TOC
2010-06-05 11:30:47 +02:00

50 lines
1 KiB
Text

<?php
// $Id$
/**
* @file
* Automatically adds a table of contents block on advanced_help pages.
*
* @copyright Ouest Systèmes Informatiques (OSInet)
*
* @license Licensed under the General Public License version 2 and later.
*/
/**
* Module name
* @var string
*/
define('AH_TOC_MODULE', 'ah_toc');
/**
* Implementation of hook_help().
*
* @return string
*/
function ah_toc_help($section, $arg) {
if ($section == 'admin/help#'. AH_TOC_MODULE) {
$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.');
}
else {
$ret = NULL;
}
return $ret;
}
/**
* Implementation of hook_init().
*
* Add the AH TOC CSS and JS only on AH pages, and not on main AH index page.
*
* @return void
*/
function ah_toc_init() {
if (arg(0) != 'help') {
return;
}
$path = drupal_get_path('module', AH_TOC_MODULE);
drupal_add_js($path .'/'. AH_TOC_MODULE .'.js');
drupal_add_css($path .'/'. AH_TOC_MODULE .'.css');
}