Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3eabe0c
)
MDL-29394 form editor - Use hidden field when only 1 format option is available #947
author
Colin Chambers
<c.chambers@open.ac.uk>
Mon, 19 Sep 2011 09:40:46 +0000
(10:40 +0100)
committer
Eloy Lafuente (stronk7)
<stronk7@moodle.org>
Mon, 19 Sep 2011 22:35:01 +0000
(
00:35
+0200)
lib/form/editor.php
patch
|
blob
|
blame
|
history
diff --git
a/lib/form/editor.php
b/lib/form/editor.php
index
eeec855
..
2cb5e06
100644
(file)
--- a/
lib/form/editor.php
+++ b/
lib/form/editor.php
@@
-237,12
+237,12
@@
class MoodleQuickForm_editor extends HTML_QuickForm_element {
$str .= '</textarea></div>';
$str .= '<div>';
$str .= '</textarea></div>';
$str .= '<div>';
- $str .= '<select name="'.$elname.'[format]">';
- foreach ($formats as $key=>$desc) {
- $selected = ($format == $key) ? 'selected="selected"' : '';
- $str .= '<option value="'.s($key).'" '.$selected.'>'.$desc.'</option>';
+ if (count($formats)>1) {
+ $str.= html_writer::select($formats, $elname.'[format]', $format, false);
+ } else {
+ $str.= html_writer::empty_tag('input',
+ array('name'=>$elname.'[format]', 'type'=> 'hidden', 'value' => array_pop(array_keys($formats))));
}
}
- $str .= '</select>';
$str .= '</div>';
// during moodle installation, user area doesn't exist
$str .= '</div>';
// during moodle installation, user area doesn't exist