You are here

function _tableofcontents_load in Table of Contents 7

Same name and namespace in other branches
  1. 6.3 tableofcontents.module \_tableofcontents_load()

Load the extra data for the node from the TOC table.

1 call to _tableofcontents_load()
tableofcontents_node_load in ./tableofcontents.module
Implementation of hook_node_load

File

./tableofcontents.module, line 159
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_load(&$node) {
  $result = db_select('tableofcontents_node_toc', 'toc')
    ->fields('toc', array(
    'toc_automatic',
  ))
    ->condition('nid', $node->nid)
    ->execute()
    ->fetch();
  if (!empty($result) && ($toc = $result->toc_automatic)) {
    $node->tableofcontents_toc_automatic = $toc;
  }
  else {
    $node->tableofcontents_toc_automatic = 0;
  }
}