diff --git a/mod/data/view.php b/mod/data/view.php
index 0b76db04996..69bbb6d636a 100644
--- a/mod/data/view.php
+++ b/mod/data/view.php
@@ -300,11 +300,16 @@
$title = $courseshortname.': ' . format_string($data->name);
if ($PAGE->user_allowed_editing()) {
- $buttons = '
';
- $PAGE->set_button($buttons);
+ // Change URL parameter and block display string value depending on whether editing is enabled or not
+ if ($PAGE->user_is_editing()) {
+ $urlediting = 'off';
+ $strediting = get_string('blockseditoff');
+ } else {
+ $urlediting = 'on';
+ $strediting = get_string('blocksediton');
+ }
+ $url = new moodle_url($CFG->wwwroot.'/mod/data/view.php', array('id' => $cm->id, 'edit' => $urlediting));
+ $PAGE->set_button($OUTPUT->single_button($url, $strediting));
}
if ($mode == 'asearch') {