Solution: Overriding kernel error templates

Match conditions

Templates used/called by the kernel/error view do indeed have a couple design keys that could be used for override via override.ini(.append.php). Besides the obvious Source filter, it is also possible to use:

  • error_type: this is always kernel for the standard modules,
  • error_number: 1 for access denied, etc.

For all intents and purposes, however, this is not a viable method of displaying custom error templates because it is not possible to match on a given view.

Template variables

kernel/error/view.php passes very (very) little useful information to the various error_code templates, so there is nothing natively available in these templates to
use for doing things like for example a switch/case on section.

The best solution at the time of writing is to use $redirect_uri, from which it is possible to extract the module, current node ID, etc.


Based on a summary by Andrew Kelly in Trouble overriding "Access Denied" template (eZ forums)