| 1 |
<?php |
<?php |
| 2 |
// $Id: blocks404.module,v 1.3 2009/01/06 06:39:55 johnalbin Exp $ |
// $Id: blocks404.module,v 1.4 2009/01/06 06:42:50 johnalbin Exp $ |
| 3 |
|
|
| 4 |
define('BLOCKS404_PAGE', 'blocks404'); |
define('BLOCKS404_PAGE', 'blocks404'); |
| 5 |
|
|
| 19 |
/** |
/** |
| 20 |
* Implements hook_menu(). |
* Implements hook_menu(). |
| 21 |
*/ |
*/ |
| 22 |
function blocks404_menu() { |
function blocks404_menu($may_cache) { |
| 23 |
$items[BLOCKS404_PAGE] = array( |
$items = array(); |
| 24 |
'title' => 'Page not found', |
if ($may_cache) { |
| 25 |
'access callback' => TRUE, |
$items[] = array( |
| 26 |
'page callback' => 'blocks404_404_page', |
'path' => BLOCKS404_PAGE, |
| 27 |
'type' => MENU_CALLBACK, |
'title' => 'Page not found', |
| 28 |
); |
'access' => TRUE, |
| 29 |
|
'callback' => 'blocks404_404_page', |
| 30 |
|
'type' => MENU_CALLBACK, |
| 31 |
|
); |
| 32 |
|
} |
| 33 |
return $items; |
return $items; |
| 34 |
} |
} |
| 35 |
|
|
| 53 |
/** |
/** |
| 54 |
* Implements hook_form_alter(). |
* Implements hook_form_alter(). |
| 55 |
*/ |
*/ |
| 56 |
function blocks404_form_system_error_reporting_settings_alter(&$form, $form_state) { |
function blocks404_form_alter($form_id, &$form) { |
| 57 |
// Since we don't care what site_404 is set to, let the user set it if they want. |
if ($form_id == 'system_error_reporting_settings') { |
| 58 |
if ($form['site_404']['#default_value'] == BLOCKS404_PAGE) { |
// Since we don't care what site_404 is set to, let the user set it if they want. |
| 59 |
$form['site_404']['#default_value'] = ''; |
if ($form['site_404']['#default_value'] == BLOCKS404_PAGE) { |
| 60 |
|
$form['site_404']['#default_value'] = ''; |
| 61 |
|
} |
| 62 |
} |
} |
| 63 |
} |
elseif ($_GET['q'] == BLOCKS404_PAGE) { |
| 64 |
|
include_once('./'. drupal_get_path('module', 'blocks404') .'/blocks404.active.inc'); |
| 65 |
/** |
_blocks404_form_alter($form_id, $form); |
|
* Implements hook_form_alter(). |
|
|
*/ |
|
|
function blocks404_form_alter(&$form, $form_state, $form_id) { |
|
|
if ($_GET['q'] == BLOCKS404_PAGE) { |
|
|
module_load_include('inc', 'blocks404', 'blocks404.active'); |
|
|
_blocks404_form_alter($form, $form_state, $form_id); |
|
| 66 |
} |
} |
| 67 |
} |
} |