Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hello,
In case of multiple values fields, the postProcess method of field enhancers is applied to each individual value of the field but the prepareForInput is applied to the array of values.
I will provide a patch to have the prepareForInput method also applied to each individual value of the field.
Comments
Comment #2
GrimreaperHere is the patch.
Thanks for the review.
Comment #3
e0ipsoThis patch uses the schema information to derive the field cardinality. @Grimreaper please review.
Comment #4
GrimreaperHello @e0ipso,
Thanks for the patch. Here is an updated one.
I have added a check if the field exists in the field storage definitions because otherwise there was a fatal error for computed/pseudo fields such as "path".
Otherwise the patch works for me.
As I post a new patch, I don't know if I should change the status to RTBC.
Comment #6
e0ipsoLooks good to me!
Comment #7
GrimreaperThanks for the commit :)
Comment #8
GrimreaperIn case of fields with cardinality > 1 with no value. $field_value is null so it raises a warning.
Don't know why I didn't see the warning before, sorry.
Here is a patch. Thanks for the review.
Comment #10
e0ipsoThanks again. Please keep reporting and fixing like this! :-P