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.

CommentFileSizeAuthor
tinymce.module_14.patch699 bytestangent

Comments

tangent’s picture

Status: Needs review » Reviewed & tested by the community

Commit this.

sun’s picture

Status: Reviewed & tested by the community » Needs review
tangent’s picture

What 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.

tangent’s picture

Status: Needs review » Closed (won't fix)

Closing this because I don't care anymore.