You are here

function _tableofcontents_settings in Table of Contents 6.2

Same name and namespace in other branches
  1. 5.2 tableofcontents.module \_tableofcontents_settings()
  2. 6.3 tableofcontents.admin.inc \_tableofcontents_settings()
  3. 7 tableofcontents.admin.inc \_tableofcontents_settings()

Return the form used for the filter settings.

Parameters

$format: The currently selected input format.

1 call to _tableofcontents_settings()
tableofcontents_filter in ./tableofcontents.module
Implementation of hook_filter().

File

./tableofcontents.module, line 237
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_settings($format) {
  $form['tableofcontents'] = array(
    '#type' => 'fieldset',
    '#title' => t('Table of Contents'),
    '#collapsible' => TRUE,
  );
  $form['tableofcontents']['tableofcontents_allow_override_' . $format] = array(
    '#title' => t('Allow users to override these settings within the &lt;!--tableofcontents--&gt; tag'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('tableofcontents_allow_override_' . $format, TRUE),
  );
  $form['tableofcontents']['tableofcontents_remove_teaser_' . $format] = array(
    '#title' => t('Remove Table of Contents tags from teasers'),
    '#type' => 'checkbox',
    '#default_value' => variable_get("tableofcontents_remove_teaser_{$format}", TRUE),
    '#description' => t('If this setting is changed, each node may need to be re-edited to reflect the new setting. This will also cause every node with a Table of Contents to have a split teaser. If you have many nodes, the <a href="@retease">Retease module</a> can help to do this automatically.', array(
      '@retease' => url('http://drupal.org/project/retease'),
    )),
  );
  $form['tableofcontents']['tableofcontents_title_' . $format] = array(
    '#title' => t('Table of Contents Title'),
    '#type' => 'textfield',
    '#size' => 64,
    '#maxlength' => 1024,
    '#default_value' => variable_get('tableofcontents_title_' . $format, 'Table of Contents'),
    '#description' => t('Enter a default title for each Table of Contents. This will be translated for each individual page.'),
  );
  $form['tableofcontents']['tableofcontents_list_type_' . $format] = array(
    '#title' => t('List Type'),
    '#type' => 'radios',
    '#options' => array(
      'ol' => t('Ordered list'),
      'ul' => t('Unordered list'),
    ),
    '#default_value' => variable_get('tableofcontents_list_type_' . $format, 'ol'),
  );
  $form['tableofcontents']['tableofcontents_minlevel_' . $format] = array(
    '#title' => t('Minimum heading level'),
    '#type' => 'select',
    '#multiple' => FALSE,
    '#options' => array(
      1 => "1",
      2 => "2",
      3 => "3",
      4 => "4",
      5 => "5",
      6 => "6",
    ),
    '#default_value' => variable_get('tableofcontents_minlevel_' . $format, 2),
  );
  $form['tableofcontents']['tableofcontents_maxlevel_' . $format] = array(
    '#title' => t('Minimum heading level'),
    '#type' => 'select',
    '#multiple' => FALSE,
    '#options' => array(
      1 => "1",
      2 => "2",
      3 => "3",
      4 => "4",
      5 => "5",
      6 => "6",
    ),
    '#default_value' => variable_get('tableofcontents_maxlevel_' . $format, 3),
  );
  $form['tableofcontents']['tableofcontents_attachments_' . $format] = array(
    '#title' => t('Show attachments in the table of contents'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('tableofcontents_attachments_' . $format, FALSE),
  );
  return $form;
}