Same as #626354: Remove #process pattern from number field and others.
Extracted from #414424: Introduce Form API #type 'text_format'.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | drupal.text-field-process.11.patch | 18.04 KB | yched |
| #10 | drupal.text-field-process.10.patch | 17.93 KB | sun |
| #5 | drupal.text-field-process.5.patch | 16.55 KB | sun |
| #3 | drupal.text-field-process.4.patch | 16.23 KB | sun |
| #2 | drupal.text-field-process.3.patch | 15.9 KB | sun |
Comments
Comment #1
yched commentedProbably wiser to turn this into a separate patch after all...
Will review asap.
Comment #2
sunContains debugging code, because the value of 'format' isn't carried over in node previews.
Comment #3
sunFixed it. :) This one is ready to fly.
Comment #4
moshe weitzman commentedLooks like we can drop text_theme() now?
Comment #5
sunNice catch!
Comment #7
moshe weitzman commented2 testfailures. Once those are cleared, this is RTBC.
Comment #8
yched commentedAs I wrote back in #414424: Introduce Form API #type 'text_format', I think we should get rid of the $field_key = $base['#columns'][n] abstraction, and use the actual column names for text field ('value', 'format', 'summary').
This abstraction only makes sense in options.module widgets, since they're more tricky (*god* they are). The code here is now simple enough that a different field type with different columns that wants similar widgets can just reimplement their own. Those widgets here will be used for text fields, period. Text.module is the #1 people look for sample code, let's keep it simple.
I have an updated patch ready if we agree on this ;-)
Other than that, minor remark:
Not sure why we take $element by reference ?
We don't need it, and that doesn't seem standard for form.inc's _value callbacks either ?
Also, all other widgets now use a form_set_value() in a validate callback for these sorts of things (turning widget values into field values).
Hopefully #414424: Introduce Form API #type 'text_format' will get rid of this anyway, but shouldn't we be consistent meanwhile ?
I'm on crack. Are you, too?
Comment #9
yched commentedTest failures: previously text.module displayed 'Full text' as the title of the textarea. Bug introduced by the 'JS show/hide summary' patch. This patch rightfully changes that to display the field label, but then node.test lines 915 and 949 need to be changed from
to
[edit: er, 'Baz' for line 949, actually...]
Comment #10
sunImplemented all of the remaining suggestions and fixes.
Comment #11
yched commentedrerolled after #645850: Remove unused varaibles in text module. I'm surprised that the bot didn't report stale patch yet.
+ minor changes.
- removed unneeded !empty() around $instance['settings']['text_processing']
- added missing
- displays summary only for 'text_textarea_with_summary' widget.
That widget might very well be extraneous and get actually merged with 'text_textarea', but removing it doesn't seem to be in the intended scope of sun's patch. That's for a followup patch to remove it properly. This patch just cleans up implementation in a feature-constant way.
Other than that, RTBC after bot comes back green.
Comment #12
yched commentedGreen.
Comment #13
webchickCommitted to HEAD. Thanks!
Is this the last of them? :)
Comment #14
sunYes, that seemed to be the last of this series! :)
YAY! for SANE FIELD WIDGETS!
Thanks, yched! I'd say that was a very nice peer-review action :)
Comment #15
yched commented@webchick: yup, last widgets. Options module has a large followup though: #639466: hook_options_list() + XSS filtering
Er, now let's break formatters :-p ? See #438570: Field API conversion leads to lots of expensive function calls, followups #52, #55, #61.
@sun: 't was indeed ! w00t.