The form generated when only one format is available hasn't been correctly updated from D6 :

$form[$format->format] = array('#type' => 'value', '#value' => $format->format, '#parents' => $parents);

This was OK in D6, when the format selectors were separate '#type' = 'radio' form elements keyed by $format->format (http://api.drupal.org/api/function/filter_form/6)
It does not match the D7 structure, where the format selector is a select (http://api.drupal.org/api/function/filter_form/7)

The line above should be :

$form['format'] = array('#type' => 'value', '#value' => $format->format, '#parents' => $parents);
CommentFileSizeAuthor
fix_filter_format.patch1.59 KByched

Comments

catch’s picture

This doesn't seem to be breaking anything obvious at the moment - is it causing issues with another patch? Worth writing a test for?

yched’s picture

I encountered this when working on #375907: Make text field use D7 '#text_format' selector. If / when #412016: Custom key name for #text_format. gets fixed, then the former shouldn't hit the bug anymore.

Other than that, it in fact doesn't break anything obvious right now, so I'm not sure what to write a test against.
More a matter of consistency between the 'multiple formats available' and 'only one format available' code branches. In the end, it does currently produce similar $form_state['values'] structure, but It could however make odd behaviors pop up later.
Comparing the D6 and D7 versions of filter_form() make it pretty clear that the last code branch was not updated to match the generic case, so I think we should fix this anyway.

David_Rothstein’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, this seems like a no-brainer and a simple fix. In fact, it was noted a while ago in #304330: Text format widget, just never included in the final patch that was committed there.

sun’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Sorry, but it makes no sense to fix the mess in countless other issues.