mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-23196, fixed html block data structure problem
This commit is contained in:
parent
b5e1ffe456
commit
b13842891f
1 changed files with 15 additions and 11 deletions
|
@ -47,21 +47,25 @@ class block_html_edit_form extends block_edit_form {
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_data($defaults) {
|
function set_data($defaults) {
|
||||||
$block = $this->block;
|
if (!empty($this->block->config) && is_object($this->block->config)) {
|
||||||
$draftid_editor = file_get_submitted_draft_itemid('config_text');
|
$text = $this->block->config->text;
|
||||||
if (!empty($block->config) && is_object($block->config)) {
|
$draftid_editor = file_get_submitted_draft_itemid('config_text');
|
||||||
$data = clone($block->config);
|
if (empty($text)) {
|
||||||
$block->config->text = array();
|
|
||||||
if (empty($data->text)) {
|
|
||||||
$currenttext = '';
|
$currenttext = '';
|
||||||
} else {
|
} else {
|
||||||
$currenttext = $data->text;
|
$currenttext = $text;
|
||||||
}
|
}
|
||||||
$block->config->text['text'] = file_prepare_draft_area($draftid_editor, $block->context->id, 'block_html', 'content', 0, array('subdirs'=>true), $currenttext);
|
$defaults->config_text['text'] = file_prepare_draft_area($draftid_editor, $this->block->context->id, 'block_html', 'content', 0, array('subdirs'=>true), $currenttext);
|
||||||
$block->config->text['itemid'] = $draftid_editor;
|
$defaults->config_text['itemid'] = $draftid_editor;
|
||||||
$block->config->text['format'] = $data->format;
|
$defaults->config_text['format'] = $this->block->config->format;
|
||||||
unset($data);
|
} else {
|
||||||
|
$text = '';
|
||||||
}
|
}
|
||||||
|
// have to delete text here, otherwise parent::set_data will empty content
|
||||||
|
// of editor
|
||||||
|
unset($this->block->config->text);
|
||||||
parent::set_data($defaults);
|
parent::set_data($defaults);
|
||||||
|
// restore $text
|
||||||
|
$this->block->config->text = $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue