I'm trying to use the form tag to set wysiwyg settings for a given input format. The patterns XML looks something like:

  <form>
    <form_id>wysiwyg_profile_form</form_id>
    <args>
      <profile>
        <format>2</format>
        <editor>fckeditor</editor>
      </profile>
    </args>
    <basic>
     ...
    </basic>
    <buttons>
      <default>
        <Bold>1</Bold>
        <StrikeThrough>1</StrikeThrough>
        <JustifyRight>1</JustifyRight>
        <OrderedList>1</OrderedList>
        <Unlink>1</Unlink>
        <TextColor>1</TextColor>
        <Outdent>1</Outdent>
      </default>
...
   </form>

The problem is that the mixed-case tag names (e.g. Bold) get automatically lowercase'd in _patterns_parse_tag(). This causes these values to not get saved in wysiwyg_profile_form_submit() since the field names no longer match to what the form builder expects.

Although the Wysiwyg module should ideally not be using mixed-cased form field names it is possible that other forms in the Drupal ecosystem may also do this. So the solution would be to allow for mixed-case tag names in the XML but in a backwards-compatible way such that existing users of the pattern module are not affected by any such change.

We could add a special attribute to tags which tells Patterns not to lowercase the tag name. This attribute would then be stripped out when the pattern gets loaded. For example:

<Bold _mixedcase_="true">..</Bold>

What does everyone think of this idea?

Comments

vaish’s picture

Status: Active » Fixed

Real cause of this issue was PHP's xml_parse_into_struct() function that by default converts all the tags to upper case. Disabling that feature and removing strtolower() from _patterns_parse_tag() fixed the issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.