You are here

toc_node.install in TOC Node 7

Set up database table used to store Table Of Contents settings for individual nodes.

File

toc_node.install
View source
<?php

/**
 * @file
 * Set up database table used to store Table Of Contents settings for individual nodes.
 */

/**
 * Implementation of hook_schema().
 */
function toc_node_schema() {
  $schema['toc_node'] = array(
    'description' => t("Store Table Of Contents settings for individual nodes."),
    'fields' => array(
      'nid' => array(
        'description' => t("ID key of node."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '10',
      ),
      'style' => array(
        'description' => t("TOC display style."),
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => 'none',
      ),
      'level' => array(
        'description' => t("TOC maximum level depth."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '10',
      ),
      'back_links' => array(
        'description' => t("Back to top links display."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '10',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function toc_node_uninstall() {
  $types = (array) node_type_get_types();
  foreach ($types as $type => $type_info) {
    variable_del('toc_node_enabled_' . $type);
    variable_del('toc_node_level_' . $type);
    variable_del('toc_node_styles_' . $type);
    variable_del('toc_node_style_default_' . $type);
    variable_del('toc_node_back_to_top_links_' . $type);
  }
}

Functions

Namesort descending Description
toc_node_schema Implementation of hook_schema().
toc_node_uninstall Implements hook_uninstall().