Skip to content

Commit

Permalink
MDL-77761 core_form: Add label for editor format selector
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Mar 28, 2023
1 parent 170be96 commit 54ed532
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions lang/en/editor.php
Expand Up @@ -53,6 +53,7 @@
$string['delete'] = 'Delete';
$string['editors'] = 'Text editors';
$string['editorsettings'] = 'Manage editors';
$string['editorxformat'] = '{$a} format';
$string['enterurlfirst'] = 'You have to enter an URL first';
$string['filebrowser'] = 'File Browser';
$string['findwhat'] = 'Find';
Expand Down
2 changes: 1 addition & 1 deletion lib/editor/atto/tests/behat/autosave.feature
Expand Up @@ -21,7 +21,7 @@ Feature: Atto Autosave
And I click on "Save changes" "button"
And I am on "Course 1" course homepage
And I navigate to "Edit settings" in current page administration
And I set the field with xpath "//select[@name='summary_editor[format]']" to "1"
And I set the field "Course summary format" to "1"
And I click on "Save and display" "button"
And I log out

Expand Down
1 change: 1 addition & 0 deletions lib/form/editor.php
Expand Up @@ -444,6 +444,7 @@ function toHtml() {
$context['id'] = $id;
$context['value'] = $text;
$context['format'] = $format;
$context['formatlabel'] = get_string('editorxformat', 'editor', $this->_label);

if (!is_null($this->getAttribute('onblur')) && !is_null($this->getAttribute('onchange'))) {
$context['changelistener'] = true;
Expand Down
1 change: 1 addition & 0 deletions lib/form/templates/editor_textarea.mustache
Expand Up @@ -35,6 +35,7 @@
</div>
<div>
{{#hasformats}}
<label for="menu{{name}}format" class="sr-only">{{formatlabel}}</label>
<select name="{{name}}[format]" id="menu{{name}}format" class="custom-select">
{{#formats}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{text}}</option>
Expand Down
6 changes: 3 additions & 3 deletions mod/workshop/tests/behat/embedded_images.feature
Expand Up @@ -21,9 +21,9 @@ Feature: Teachers can embed images into instructions and conclusion fields
| workshop | C1 | Workshop with embedded images |
And I am on the "Workshop with embedded images" "workshop activity editing" page logged in as admin
And I set the following fields to these values:
| instructauthorseditor[format] | 1 |
| instructreviewerseditor[format] | 1 |
| conclusioneditor[format] | 1 |
| Instructions for submission format | 1 |
| Instructions for assessment format | 1 |
| Conclusion format | 1 |
And I press "Save and display"
And I log out
And I log in as "teacher1"
Expand Down

0 comments on commit 54ed532

Please sign in to comment.