You are here

function tableofcontents_form_alter in Table of Contents 7.2

Same name and namespace in other branches
  1. 6.3 tableofcontents.module \tableofcontents_form_alter()
  2. 7 tableofcontents.module \tableofcontents_form_alter()

Add a field in nodes so one can mark the node as using a TOC without the need for the [toc] tag.

File

./tableofcontents.module, line 216
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_form_alter(&$form, $form_state, $form_id) {
  if (!$form_state['submitted']) {
    if (substr($form_id, -10) == '_node_form' && isset($form['nid'])) {
      module_load_include('admin.inc', 'tableofcontents');
      _tableofcontents_node_form_alter($form);
    }
    elseif ($form_id == 'node_type_form') {
      module_load_include('admin.inc', 'tableofcontents');
      _tableofcontents_nodetype_form_alter($form);
    }
    elseif ($form_id == 'filter_admin_format_form') {
      $form['#submit'][] = 'tableofcontents_filter_settings_submit';
    }
  }
}