Skip to content

Commit

Permalink
MDL-74773 contentbank: add notification when updating and creating
Browse files Browse the repository at this point in the history
  • Loading branch information
danielneis committed Aug 2, 2023
1 parent a1d5d1b commit a7a3f58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion contentbank/edit.php
Expand Up @@ -123,10 +123,15 @@
}
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();
Expand Down
2 changes: 2 additions & 0 deletions lang/en/contentbank.php
Expand Up @@ -36,6 +36,8 @@
$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';
Expand Down

0 comments on commit a7a3f58

Please sign in to comment.