Merge branch 'wip-MDL-29006-master' of git://github.com/samhemelryk/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2011-09-06 00:38:10 +02:00
+13
View File
@@ -57,11 +57,24 @@ class block_html_edit_form extends block_edit_form {
} 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;
}
}
}