I have a custom module that is formatting the display of an image field, which can accept multiple values.
I would like to know what hook I should use to duplicate the first value of the field (e.g. "[image1]"), and add it back to the beginning of the array (with array_unshift()
I guess) before the rest of my functions format the display/theme of the field.
So what was
- [image1]
- [image2]
- [image3]
becomes
- [image1]
- [image1]
- [image2]
- [image3]
I am then going to theme them separately, but I think I already have that part figured out.
I am currently using hook_field_formatter_view()
, and have tried to just add it to the beginning of the $items
array at the top of the function, but that didn't seem to work. If I immediately dprint_r()
the $items
array after this it shows, but only 3 items get output; I am assuming that the number of field gets determined elsewhere.
hook_field_formatter_view
but it only runs once per image.