You are here

function tableofcontents_block_form_filter_admin_format_form_alter in Table of Contents 7

Implementation of hook_form_FORM_ID_alter().

File

tableofcontents_block/tableofcontents_block.module, line 130
main file for module providing a block

Code

function tableofcontents_block_form_filter_admin_format_form_alter(&$form, &$form_state, $form_id) {

  // verify that the table of contents is turned in that filter.
  if (isset($form['filters']['settings']['filter_toc']['tableofcontents'])) {
    $format = $form['#format']->format;

    // add block specific settings to this filter
    $form['filters']['settings']['filter_toc']['tableofcontents']['tableofcontents_block'] = array(
      '#type' => 'fieldset',
      '#title' => t('Table of Contents block'),
      '#collapsible' => TRUE,
    );
    $form['filters']['settings']['filter_toc']['tableofcontents']['tableofcontents_block']['tableofcontents_block_only_table_' . $format] = array(
      '#title' => t('Block-only table of contents'),
      '#type' => 'checkbox',
      '#default_value' => variable_get('tableofcontents_block_only_table_' . $format, FALSE),
      '#description' => 'When checked, all the table of contents are removed from node bodies, only headers are altered. This allows for a block-only table of contents.',
    );
  }
}