On the user account settings page, the "TinyMCE rich-text settings" fieldset always appears at the top of the form. I discovered that the reason is that the form is not being properly constructed and the weight value is ignored.
$form['tinymce'] = array(
'#type' => 'fieldset',
'#title' => t('TinyMCE rich-text settings'),
'#weight' => 10,
'#collapsible' => TRUE,
'#collapsed' => TRUE
);
$form['tinymce']['tinymce_status'] = array(
'#type' => 'select',
'#title' => t('Default state'),
'#default_value' => isset($user->tinymce_status) ? $user->tinymce_status : (isset($profile->settings['default']) ? $profile->settings['default'] : 'false'),
'#options' => array('false' => t('disabled'), 'true' => t('enabled')),
'#description' => t('Should rich-text editing be enabled or disabled by default in textarea fields?')
);
return array('tinymce' => $form);
This results in an array structure like the following.
Array
(
[tinymce] => Array
(
[tinymce] => Array
(
[#type] => fieldset
[#title] => TinyMCE rich-text settings
[#weight] => 10
[#collapsible] => 1
[#collapsed] => 1
[tinymce_status] => Array
(
[#type] => select
[#title] => Default state
[#default_value] => false
[#options] => Array
(
[false] => disabled
[true] => enabled
)
[#description] => Should rich-text editing be enabled or disabled by default in textarea fields?
)
)
)
)
The outer "tinymce" array is redundant. The attached patch resolves this.
| Comment | File | Size | Author |
|---|---|---|---|
| tinymce.module_14.patch | 699 bytes | tangent |
Comments
Comment #1
tangent commentedCommit this.
Comment #2
sunComment #3
tangent commentedWhat needs review here? My explanation or the quality of the patch? Why don't you give it a try yourself?
The problem (and solution) is pretty obvious in my opinion.
Comment #4
tangent commentedClosing this because I don't care anymore.