I'm struggling with #type 'text_format' for a widget form field as this field gets expanded two separate elements, one holding the orignal element and the other the format selector. The orignal element is moved into a child element.
All of this is fine, but as the orignal field is now moved into a child when the widget form is saved is tries to save the child element (array). As the widgets fields have to be at the root of the form with names that match 1:1 with db columns.
If the property #text_format is set, the form element will be expanded into two separate form elements, one holding the content of the element, and the other holding the text format selector. The original element is shifted into a child element, but is otherwise unaltered, so that the format selector is at the same level as the text field which it affects.
I've looked at the text.module but I can't work out how it is getting around the issue of the field being expanded?