MDL-75909 mod_data: Make template editor use html editor

When the template editor is configured to use the HTML Editor, it should
indicate this to Behat by setting the `data-fieldtype` to "editor".

This indicates to the behat field manager that the editor is in use,
which ensures that the correct value setting can take place.

This is important in the context of MDL-75887.
This commit is contained in:
Andrew Nicols
2022-10-06 21:49:08 +08:00
parent 141657a483
commit 482de4e370
+6 -4
View File
@@ -183,8 +183,10 @@ if (($mode === 'csstemplate') || ($mode === 'jstemplate')) {
$usehtmleditor = data_get_config($data, "editor_{$mode}", true);
}
$datafieldtype = '';
if ($usehtmleditor) {
$format = FORMAT_HTML;
$datafieldtype = ' data-fieldtype="editor" ';
} else {
$format = FORMAT_PLAIN;
}
@@ -226,7 +228,7 @@ if ($mode == 'listtemplate'){
$field = 'listtemplateheader';
$editor->set_text($data->listtemplateheader);
$editor->use_editor($field, $options);
echo '<div><textarea id="'.$field.'" name="'.$field.'" class="form-control" rows="15" cols="80">' .
echo "<div><textarea id='{$field}' {$datafieldtype} name='{$field}' class='form-control' rows='15' cols='80'>" .
s($data->listtemplateheader) . '</textarea></div>';
echo '</td>';
@@ -344,7 +346,7 @@ $field = 'template';
$editor->set_text($data->{$mode});
$editor->use_editor($field, $options);
echo '<div>';
echo '<textarea class="form-control" id="' . $field . '" ' .
echo '<textarea class="form-control" id="' . $field . '" ' . $datafieldtype .
'name="' . $field . '" rows="15" cols="80">' . s($data->{$mode}) . '</textarea>';
echo '</div>';
echo '</td>';
@@ -360,7 +362,7 @@ if ($mode == 'listtemplate'){
$editor->set_text($data->listtemplatefooter);
$editor->use_editor($field, $options);
echo '<div>';
echo '<textarea id="' . $field . '" class="form-control" ' .
echo '<textarea id="' . $field . '" class="form-control" ' . $datafieldtype .
'name="' . $field . '" rows="15" cols="80">' . s($data->listtemplatefooter) . '</textarea>';
echo '</div>';
echo '</td>';
@@ -377,7 +379,7 @@ if ($mode == 'listtemplate'){
$editor->set_text($data->rsstitletemplate);
$editor->use_editor($field, $options);
echo '<div>';
echo '<textarea id="' . $field . '" name="' . $field . '" ' .
echo '<textarea id="' . $field . '" name="' . $field . '" ' . $datafieldtype .
'class="form-control" rows="15" cols="80">' . s($data->rsstitletemplate) . '</textarea>';
echo '</div>';
echo '</td>';