I got the error above if the field formatter settings contain an array as value. To fix that I added a condition which checks whether the value is an array. A use case is the Linked Field module - I couldn't change the wrapper of the ds title field without getting that error.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | core-DateTimeTimeAgoFormatter-1982646-11226229.patch | 1.31 KB | slanger |
Comments
Comment #1
yannickooComment #2
yannickooJust guessing that we need the same for Drupal 8, attached patch.
Comment #3
swentel commentedLooks sane, committed and pushed, thanks!
Comment #5
inventlogic commentedI am getting this error when trying to add the physical fields weight or dimension to a display suite display mode.
I am using the 7.x-2.4 version of display suite which has this patch but it does not fix the issue for the physical fields.
The error occurs every time i change the region for the fields which immediately generates an Ajax error.
The error message I am seeing in the Firefox console
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /var/virtualsites/mysite/html/includes/bootstrap.inc on line 1559Why does the patch not fix the issue for the physical fields?
Comment #6
a.milkovskyPlease fix it also in the 7.x-1.x branch...
ISSUE LINK: Warning: htmlspecialchars() ....
Comment #7
tontoman commentedI had the same problem and basically what fixed it for me was that I went through the Content types that we causing the problem and I discovered that I have dollar values on the content types with a decimal point and it needed to be a whole numbers .... so 0.5 and 1.2 was what was causing the problem in my case. Hope this helps someone. Peace.
Comment #8
kevinquillen commentedNot sure if this belongs in the core queue or not, but I get this error with DS + Paragraphs enabled. Specifically related to a datetime field with the formatter set to 'Time ago'.
The options for future date and past date do not show on the field settings form. The settings summary for these values are being passed as arrays.
I noticed that the core Post date on a node type does not have a 'Time ago' format option, it only lets you select date formats (long, medium, short).
I would suspect this is possibly a core issue though I could not find a relevant issue for it, because without DS enabled, this error is never displayed for me on field UI display forms.
Comment #15
kevinquillen commentedSorry - didn't mean to select 'Needs Review' and blow up testbot.
Comment #16
sgurlt commentedI can confirm what kevinquillen wrote, I get the same with paragraphs.
Comment #17
aspilicious commentedWell this is a core issue
Returns an array with cachable metadata in stead of a string breaking the summary
Comment #18
aspilicious commented#2732441: Time ago formatter throws notices
Comment #19
slanger commentedI agree with @aspilicious: The field formatter for "Time ago" in core is trying to replace a string token with an array of data, resulting in the error.
The following patch solved the problem for me. It renders the array of data into a string.
Thanks for tracking down the problem, @aspilicious!