I'm using this module in conjunction with Lightbox2 and I have an imagefield that I added an extra field called "description" (description|Description), I was getting this error when viewing the node: warning: mb_eregi_replace() expects parameter 3 to be string, array given and when the lightbox opens it displayed "array" as photo title.
The problem is that Llightbox2 was expecting a field called "description" of type text, this is because filefield "file upload" widget adds an item data called "description" so the field I added with the same name was conflicting with this one because it was an array instead of an string.
This is the structure for "file upload" item data:
Array
(
[description] => Lorem ipsum dolor sit ament
)
and this is the extended field:
Array
(
[description] => Array
(
[body] => Lorem ipsum dolor sit ament
[format] =>
)
)
It's not actually a bug because it can be prevented very easily just changing the extended field name to "image_description" or anything else but because "file upload" widget comes with filefield there are other contributed modules that expects "description" to be a string.
Maybe you can lock this field name (and maybe others) or at least display a warning when "description" is entered as extended field name.
Thanks you,
Javier
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedI'll look at a validation function to prevent these. Alt title and description elements will cause the same error
Comment #2
Alan D. CreditAttribution: Alan D. commentedI've pushed through the additional validation into the dev version.
Also:
Fixed 1 bug in the validation function - there was no check placed on an empty value
Added checks to enforce uniqueness of the keys between both fields. Implementing a namespace prefix would be best, but without this, the code is a lot cleaner and easier to use.
Fixed a typo in the title for the ImageField Extended Settings page
And thanks for reporting this! It is one of those trivial bugs for a developer but can be a real pain in the xxx for a non-developers that can not read / debug error messages.
Comment #3
javi-er CreditAttribution: javi-er commentedSure, I'm glad it was helpful, I agree that an issue like this can be a pain to fix by a non technical user.
Great module btw
Javier
Comment #4
Alan D. CreditAttribution: Alan D. commentedIn the dev release. This will be published in the next release cycle.
Comment #5
andrea_london CreditAttribution: andrea_london commentedHi all, I'm struggling to find out how to show my extended fields inside the lightbox2.
So far i was only able to display the title (lightbox2 default feature)
but none of my customized fields (name,desc,year,series and materials) that i've created using image_field_extended module.
I'm not a developer so any basic explanation it's really appreciated.
Thank you
Comment #6
Alan D. CreditAttribution: Alan D. commentedMyself & deciphered, is working on a way to integrate the module with custom_formatters. If this happens, it should be easy to theme up the text required to send to lightbox. Track these here: #686612: Add Tokens (and Custom Formatters support)
Once you have the text, browse the forums on the best way to inject that into lightbox description field. Possible place a feature request there to handle cutom field formatters for filefields. (A note for stella, at least 2 modules extend filefield, this one and imagefield crop, check out Inserts method of hooking into these)
Alan