Skip to content

Commit

Permalink
MDL-29006 block_html Added formatted to title printed on editing form…
Browse files Browse the repository at this point in the history
… when a hard freeze is in effect
  • Loading branch information
Sam Hemelryk committed Aug 30, 2011
1 parent 4ad6128 commit 3485687
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions blocks/html/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 3485687

Please sign in to comment.