You are here

function tableofcontents_filter_FILTER_tips in Table of Contents 7

Implementation of hook_filter_FILTER_tips().

File

./tableofcontents.module, line 69
This is a filter module to generate a collapsible jquery enabled mediawiki style table of contents based on <h[1-6]> tags. Transforms header tags into named anchors.

Code

function tableofcontents_filter_FILTER_tips($filter, $format, $long = FALSE) {
  if ($filter->name == filter_toc) {
    $delta = 0;
  }
  else {
    $delta = 1;
  }
  $var = $format->format;
  $override = variable_get('tableofcontents_allow_override_' . $var, $default = TRUE);
  $op = $delta * 4 | ($long ? 2 : 0) | ($override ? 1 : 0);
  switch ($op) {

    // ($delta, $long, $override)
    case 0:

      // (0, 0, 0)
      return t('Use [toc ...] to insert a mediawiki style collapsible table of contents.');
    case 1:

      // (0, 0, 1)
      return t('Use [toc list: ol; title: Table of Contents; minlevel: 2; maxlevel: 3; attachments: yes;] to insert a mediawiki style collapsible table of contents. All the arguments are optional.');
    case 2:

      // (0, 1, 0)
      return t('Every instance of "[toc ...]" in the input text will be replaced with a collapsible mediawiki-style table of contents.');
    case 3:

      // (0, 1, 1)
      return t('Every instance of "[toc ...]" in the input text will be replaced with a collapsible mediawiki-style table of contents. Accepts options for title, list style, minimum heading level, and maximum heading level, and attachments as follows: [toc list: ol; title: Table of Contents; minlevel: 2; maxlevel: 3; attachments: yes;]. All arguments are optional.');
    case 4:

    // (1, 0, 0)
    case 5:

      // (1, 0, 1)
      return t('Add an identifier to all the anchors without one.');
    case 6:

    // (1, 1, 0)
    case 7:

      // (1, 1, 1)
      return t('Add an identifier to all the anchors without one. In most cases, this filter is not necessary with the table of contents block. However, once in a while, the automatic detection may fail. In those cases, add this filter to your pages so as to make sure to get all the anchors defined as necessary for the table of contents links to work.');
  }
}