You are here

function customerror_header in Customerror 8

Same name and namespace in other branches
  1. 5 customerror.module \customerror_header()
  2. 6 customerror.module \customerror_header()
  3. 7 customerror.module \customerror_header()

Sets the http header depending on the error code (403 or 404).

Parameters

int $code: The error code, either 403 or 404.

1 call to customerror_header()
CustomErrorController::index in src/Controller/CustomErrorController.php
This is the method that will get called, with the services above already available.

File

./customerror.module, line 60
Enables custom 404 (not found) and 403 (access denied) pages in Drupal with no need for creating real nodes under taxonomies.

Code

function customerror_header($code) {
  switch ($code) {
    case 403:
      header("HTTP/1.0 403 Access Denied");
      break;
    case 404:
      header("HTTP/1.0 404 Not Found");
      break;
  }
}