I've an image field as a part of an multiple field group with other fields like e.g. 'topic' .
For example, if I generate 3 instances of this field group with each 'topic' and 'image' everything is OK.
In the $item->fields->value
Code:
Array
(
[0] => a:4:{s:12:"originalname";s:25:"imageA.jpg";s:4:"desc";s:0:"";s:12:"existingname";s:0:"";s:6:"remove";b:0;}
[1] => a:4:{s:12:"originalname";s:29:"imageB.jpg";s:4:"desc";s:0:"";s:12:"existingname";s:0:"";s:6:"remove";b:0;}
[2] => a:4:{s:12:"originalname";s:27:"imageC.jpg";s:4:"desc";s:0:"";s:12:"existingname";s:0:"";s:6:"remove";b:0;}
)
and for $item->fields->value
Code:
Array
(
[0] => Topic A
[1] => Topic B
[2] => Topic C
)
I find everything sorted well.
But if I decide not to choose a picture for example 'Topic B' I get this wrong sorted image field array:
Code:
Array
(
[0] => a:4:{s:12:"originalname";s:25:"imageA.jpg";s:4:"desc";s:0:"";s:12:"existingname";s:0:"";s:6:"remove";b:0;}
[1] => a:4:{s:12:"originalname";s:27:"imageC.jpg";s:4:"desc";s:0:"";s:12:"existingname";s:0:"";s:6:"remove";b:0;}
)
but i expected
Code:
Array
(
[0] => a:4:{s:12:"originalname";s:25:"imageA.jpg";s:4:"desc";s:0:"";s:12:"existingname";s:0:"";s:6:"remove";b:0;}
[2] => a:4:{s:12:"originalname";s:27:"imageC.jpg";s:4:"desc";s:0:"";s:12:"existingname";s:0:"";s:6:"remove";b:0;}
)
So it's not possible to associate the images with the right instance of the multiple field group. For text fields it isn't a problem. If I choose not to fill out the topic field of the second instance I get correct
Code:
Array
(
[0] => Topic A
[2] => Topic C
)
And maybe it's part of the same problem:
Under $item->fields->display and $item->fields->thumbs_src e.g. I get only the values from array index '0' and these aren't inevitably the values of the first instance of the field group as described above.
For now I always have to unserialize the field value ($item->fields->value[$i]) to get the image filename and combine it with the $item->fields->parameters->get('dir'). So it would be nice to get direct access to the values of every instance of a field group.
Regards