You are here

node_page_disable.install in Node Page Disable 6

Same filename and directory in other branches
  1. 7 node_page_disable.install

Handles installation steps for node_page_disable

File

node_page_disable.install
View source
<?php

/**
 * @file
 * Handles installation steps for node_page_disable
 *
 * @ingroup func_search
 * @{
 */

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

  //Clean up our entries in the variables table.
  $result = db_query("SELECT name FROM {variable} WHERE `name` LIKE 'node_page_disable%'");
  while ($data = db_fetch_object($result)) {
    variable_del($data->name);
  }
}

/**
 * Implements hook_enable().
 */
function node_page_disable_enable() {

  // Set up the default value based on frontpage
  $frontpage = variable_get('site_frontpage', 'node');
  if ($frontpage == 'node') {
    variable_set('node_page_disable_path_node_keep', TRUE);
  }
  else {
    variable_set('node_page_disable_path_node_keep', FALSE);
    drupal_set_message(t('The path <a href="@url">/node</a> is no longer active.', array(
      '@url' => url('node'),
    )));
  }
  variable_set('menu_rebuild_needed', TRUE);

  // Message about module settings
  drupal_set_message(t('You may adjust settings for Node Page Disable by visiting <a href="@url">@url</a>.', array(
    '@url' => url('admin/config/system/site-information'),
  )));
}

/**
 * Implements hook_disable().
 */
function node_page_disable_disable() {

  // Make sure we rebuild the menu so the node page is visible
  variable_set('node_page_disable_path_node_keep', NODE_PAGE_DISABLE_DEFAULT);
  drupal_set_message(t('The path <a href="@url">/node</a> has been restored to the default.', array(
    '@url' => url('node'),
  )));
  variable_set('menu_rebuild_needed', TRUE);
}

/** @} */

//end of group node_page_disable