MDL-74773 contentbank: add notification when updating and creating

This commit is contained in:
Daniel Neis Araujo
2023-08-02 14:14:45 -03:00
parent a1d5d1b2f7
commit a7a3f585ce
2 changed files with 8 additions and 1 deletions
+6 -1
View File
@@ -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();
+2
View File
@@ -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';