function error_displayable

error_displayable($error = NULL)

Determines whether an error should be displayed.

When in maintenance mode or when error_level is ERROR_REPORTING_DISPLAY_ALL, all errors should be displayed. For ERROR_REPORTING_DISPLAY_SOME, $error will be examined to determine if it should be displayed.

Parameters

$error: Optional error to examine for ERROR_REPORTING_DISPLAY_SOME.

Return value

TRUE if an error should be displayed.

File

includes/errors.inc, line 151
Functions for error handling.

Code

function error_displayable($error = NULL) {
  $error_level = variable_get('error_level', ERROR_REPORTING_DISPLAY_ALL);
  $updating = (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update');
  $all_errors_displayed = ($error_level == ERROR_REPORTING_DISPLAY_ALL);
  $error_needs_display = ($error_level == ERROR_REPORTING_DISPLAY_SOME &&
    isset($error) && $error['%type'] != 'Notice' && $error['%type'] != 'Strict warning');

  return ($updating || $all_errors_displayed || $error_needs_display);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!errors.inc/function/error_displayable/7.x