MDL-68540 tool_usertours: Remove hideif workaround

We don't need to use the group element to use hideif
for text editor element anymore
This commit is contained in:
Huong Nguyen
2024-06-11 15:31:32 +07:00
parent d8d395cb19
commit a8468e727d
2 changed files with 5 additions and 7 deletions
@@ -116,11 +116,9 @@ class editstep extends \moodleform {
'changeformat' => 1,
'trusttext' => true,
];
$objs = $mform->createElement('editor', 'content', get_string('content', 'tool_usertours'), null, $editoroptions);
// TODO: MDL-68540 We need to add the editor to a group element because editor element will not work with hideIf.
$mform->addElement('group', 'contenthtmlgrp', get_string('content', 'tool_usertours'), [$objs], ' ', false);
$mform->addHelpButton('contenthtmlgrp', 'content', 'tool_usertours');
$mform->hideIf('contenthtmlgrp', 'contenttype', 'eq', static::CONTENTTYPE_LANGSTRING);
$mform->addElement('editor', 'content', get_string('content', 'tool_usertours'), null, $editoroptions);
$mform->addHelpButton('content', 'content', 'tool_usertours');
$mform->hideIf('content', 'contenttype', 'eq', static::CONTENTTYPE_LANGSTRING);
// Add the step configuration.
$mform->addElement('header', 'heading_options', get_string('options_heading', 'tool_usertours'));
@@ -27,9 +27,9 @@ Feature: Apply content type to a tour
And the "Content type" select box should contain "Manual"
And I select "Language string ID" from the "Content type" singleselect
And I should see " Language string ID"
And "#fgroup_id_contenthtmlgrp" "css_element" should not be visible
And I should not see "Content" in the "#fitem_id_content" "css_element"
And I select "Manual" from the "Content type" singleselect
And "#fgroup_id_contenthtmlgrp" "css_element" should be visible
And I should see "Content" in the "#fitem_id_content" "css_element"
And I should not see "Language string ID" in the "#fitem_id_contentlangstring" "css_element"
@javascript