Skip to content

Instantly share code, notes, and snippets.

@opi
Created March 14, 2013 15:59
Show Gist options
  • Save opi/5162579 to your computer and use it in GitHub Desktop.
Save opi/5162579 to your computer and use it in GitHub Desktop.
Drupal: Navigation 404
<?php
/**
* Implements hook_menu().
*/
function mymodule_menu() {
$items = array();
// PUBLIC PAGES
$items['error404'] = array(
'title' => "Page not found",
'page callback' => 'mymodule_404_page',
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
);
$items['error403'] = array(
'title' => "Access denied",
'page callback' => 'mymodule_403_page',
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
);
return $items;
}
/**
* Callback for 404
* Mimic navigation404 module.
*/
function mymodule_404_page() {
drupal_set_title(t("Page not found"));
return t("The requested page could not be found.");
}
/**
* Callback for 403
* Mimic navigation404 module.
*/
function mymodule_403_page() {
drupal_set_title(t("Access denied"));
return t("You are not authorized to access this page.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment