From a7a3f585ce76eccb5b35c267e99233373511d194 Mon Sep 17 00:00:00 2001 From: Daniel Neis Araujo Date: Mon, 16 May 2022 17:43:31 -0300 Subject: [PATCH] MDL-74773 contentbank: add notification when updating and creating --- contentbank/edit.php | 7 ++++++- lang/en/contentbank.php | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contentbank/edit.php b/contentbank/edit.php index db54dc35ea7..b0d8df0b3d7 100644 --- a/contentbank/edit.php +++ b/contentbank/edit.php @@ -123,10 +123,15 @@ if ($editorform->is_cancelled()) { } redirect($returnurl); } else if ($data = $editorform->get_data()) { + if (empty($id)) { + $msg = get_string('contentcreated', 'contentbank'); + } else { + $msg = get_string('contentupdated', 'contentbank'); + } $id = $editorform->save_content($data); // Just in case we've created a new content. $returnurl->param('id', $id); - redirect($returnurl); + redirect($returnurl, $msg, null, \core\output\notification::NOTIFY_SUCCESS); } echo $OUTPUT->header(); diff --git a/lang/en/contentbank.php b/lang/en/contentbank.php index 55573a35fa9..153e87372b3 100644 --- a/lang/en/contentbank.php +++ b/lang/en/contentbank.php @@ -36,6 +36,8 @@ $string['contenttypenoaccess'] = 'You cannot view this {$a} instance.'; $string['contenttypenoedit'] = 'You can not edit this content'; $string['contentvisibilitychanged'] = 'The content has been made {$a}.'; $string['contentvisibilitynotset'] = 'An error was encountered while trying to set the content visibility.'; +$string['contentcreated'] = 'Content created.'; +$string['contentupdated'] = 'Content updated.'; $string['contextnotallowed'] = 'You are not allowed to access the content bank in this context.'; $string['emptynamenotallowed'] = 'Empty name is not allowed'; $string['eventcontentcreated'] = 'Content created';