Comments

yched’s picture

Probably wiser to turn this into a separate patch after all...
Will review asap.

sun’s picture

StatusFileSize
new15.9 KB

Contains debugging code, because the value of 'format' isn't carried over in node previews.

sun’s picture

StatusFileSize
new16.23 KB

Fixed it. :) This one is ready to fly.

moshe weitzman’s picture

Status: Needs review » Needs work

Looks like we can drop text_theme() now?

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new16.55 KB

Nice catch!

Status: Needs review » Needs work

The last submitted patch failed testing.

moshe weitzman’s picture

2 testfailures. Once those are cleared, this is RTBC.

yched’s picture

As 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:

+++ modules/field/modules/text/text.module	22 Nov 2009 00:14:21 -0000
@@ -594,140 +583,14 @@ function text_field_widget_error($elemen
+function text_field_widget_formatted_text_value(&$element, $edit = FALSE, &$form_state) {

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?

yched’s picture

Test 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

$this->assertRaw('Full text', t('Body field was found.'));

to

$this->assertRaw('Body', t('Body field was found.'));

[edit: er, 'Baz' for line 949, actually...]

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new17.93 KB

Implemented all of the remaining suggestions and fixes.

yched’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new18.04 KB

rerolled 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

'#rows' => $instance['widget']['settings']['rows'],
'#rows' => $instance['widget']['settings']['summary_rows'],

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

yched’s picture

Status: Needs review » Reviewed & tested by the community

Green.

webchick’s picture

Status: Needs review » Fixed

Committed to HEAD. Thanks!

Is this the last of them? :)

sun’s picture

Yes, 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 :)

yched’s picture

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

Status: Fixed » Closed (fixed)

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