You are here

mmeu.module in Maintenance Mode Exclude Urls 7

Same filename and directory in other branches
  1. 8 mmeu.module

Module file for mmeu module.

File

mmeu.module
View source
<?php

/**
 * @file
 * Module file for mmeu module.
 */

/**
 * Implements hook_form_FORM_ID_alter() for system_site_maintenance_mode().
 */
function mmeu_form_system_site_maintenance_mode_alter(&$form, &$form_state) {
  $form['mmeu_urls'] = array(
    '#type' => 'textarea',
    '#title' => t('Exclude Urls'),
    '#description' => t("Enter pages to be shown to visitors in maintenance mode. Enter one page per line as Drupal paths. The * character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
      '%blog' => 'blog',
      '%blog-wildcard' => 'blog/*',
      '%front' => '<front>',
    )),
    '#default_value' => variable_get('mmeu_urls', ''),
  );
}

/**
 * Implements hook_menu_site_status_alter().
 */
function mmeu_menu_site_status_alter(&$menu_site_status, $path) {
  $mmeu_urls = variable_get('mmeu_urls', '');
  if ($menu_site_status == MENU_SITE_OFFLINE && trim($mmeu_urls) != '' && (drupal_match_path(drupal_get_path_alias($path), $mmeu_urls) || drupal_match_path($path, $mmeu_urls))) {
    $menu_site_status = MENU_SITE_ONLINE;
  }
}