Permalink
Browse files

Merge branch 'wip-MDL-29006-m20' of git://github.com/samhemelryk/mood…

…le into MOODLE_20_STABLE
  • Loading branch information...
2 parents cba00bd + 8068301 commit 029a753b91511ae8acc414052b23e535aa7284cd @stronk7 stronk7 committed Sep 5, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 blocks/html/edit_form.php
View
@@ -57,11 +57,24 @@ function set_data($defaults) {
} else {
$text = '';
}
+
+ if (!$this->block->user_can_edit() && !empty($this->block->config->title)) {
+ // If a title has been set but the user cannot edit it format it nicely
+ $title = $this->block->config->title;
+ $defaults->config_title = format_string($title, true, $this->page->context);
+ // Remove the title from the config so that parent::set_data doesn't set it.
+ unset($this->block->config->title);
+ }
+
// have to delete text here, otherwise parent::set_data will empty content
// of editor
unset($this->block->config->text);
parent::set_data($defaults);
// restore $text
$this->block->config->text = $text;
+ if (isset($title)) {
+ // Reset the preserved title
+ $this->block->config->title = $title;
+ }
}
}

0 comments on commit 029a753

Please sign in to comment.