You are here

modal.module in Modal operations 7

File

modal.module
View source
<?php

/**
 * Implements hook_init().
 */
function modal_init() {

  // Include the CTools tools that we need.
  ctools_include('ajax');
  ctools_include('modal');

  // Add CTools javascript to the page.
  ctools_modal_add_js();
}

/**
 * Fixes superglobal arrays.
 * @param string $path
 *   Drupal path of normal (non-modal) action.
 */
function modal_set_path_data($path) {

  // Set 'q' parameter in order to make arg() work correctly.
  $_GET['q'] = $path;
  $_REQUEST['q'] = $path;

  //  // This is disabled, since it breaks form action paths.
  //  // Set $_SERVER variables in order to make request_uri() work correctly.
  //  if (isset($_SERVER['REQUEST_URI'])) {
  //    $_SERVER['REQUEST_URI'] = base_path() . $path;
  //  }
  //  elseif (isset($_SERVER['SCRIPT_NAME'])) {
  //    $_SERVER['SCRIPT_NAME'] = base_path() . $path;
  //  }
}

Functions

Namesort descending Description
modal_init Implements hook_init().
modal_set_path_data Fixes superglobal arrays.