From 933b95f5ceeae4c61bb45e4da84a1fe20b708ba6 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Fri, 24 Feb 2017 16:34:16 +0100 Subject: [PATCH] Allow ajaxError to specify an error code as well. JI-53 --- h5p.classes.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index 1ace399..f0d2c2c 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -2690,13 +2690,18 @@ class H5PCore { * @param string $message * @since 1.6.0 */ - public static function ajaxError($message = NULL) { + public static function ajaxError($message = NULL, $error_code = NULL) { $response = array( 'success' => FALSE ); if ($message !== NULL) { $response['message'] = $message; } + + if ($error_code !== NULL) { + $response['error_code'] = $error_code; + } + self::printJson($response); }