You are here

internal_nodes.install in Internal Nodes 7

Installation file for the Internal node module

File

internal_nodes.install
View source
<?php

/**
 * @file
 * Installation file for the Internal node module
 */

/**
 * Implements hook_uninstall().
 */
function internal_nodes_uninstall() {

  // Remove variables.
  variable_del('internal_nodes_outbound_alter');
  $types = node_type_get_types();
  foreach ($types as $key => $type) {
    variable_del('internal_nodes_action_' . $key);
    variable_del('internal_nodes_url_' . $key);
    variable_del('internal_nodes_nodes_' . $key);
  }
}

/**
 * Implements hook_schema().
 */
function internal_nodes_schema() {
  $schema['internal_nodes'] = array(
    'description' => 'Stores action settings for nodes.',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {node}.nid to store settings.',
      ),
      'action' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The action to take when the node is accessed.',
      ),
      'url' => array(
        'type' => 'varchar',
        'length' => 256,
        'not null' => FALSE,
        'default' => '',
        'description' => 'The redirect URL.',
      ),
    ),
    'primary key' => array(
      'nid',
    ),
    'foreign keys' => array(
      'internal_nodes_node' => array(
        'table' => 'node',
        'columns' => array(
          'nid' => 'nid',
        ),
      ),
    ),
  );
  return $schema;
}

Functions