Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
First, thank you very much for this great module!
It is very powerful and helped me to simplify my views structure.
Nice job!!
May I ask you a php related question?
Due my lack of php knowledge I am not sure how to access the values within the "data" field of my image_fields.
I a where able to access the rendered image itself with:
$static = $this->view->display_handler->get_handlers('field');
if (!empty($static['field_image_craft_fid']->last_render)) {
echo $static['field_image_craft_fid']->last_render;
} else {
echo $static['field_primary_image_fid']->last_render;
}
But in a different case, I would also like to get within "data":
image_title
image_caption
image_source
node_data_field_primary_image_field_primary_image_fid (Array, 10 elements)
0 (Array, 3 elements)
fid (String, 1 characters ) 3
list (String, 1 characters ) 1
data (String, 526 characters ) a:7:{s:11:"image_title";a:3:{s:4:"body";s:0:"";...
a:7:{s:11:"image_title";a:3:{s:4:"body";s:0:"";s:6:"format";s:0:"";s:5:"style";s:9:"textfield";}s:13:"image_caption";a:3:{s:4:"body";s:97:"First Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.";s:6:"format";s:0:"";s:5:"style";s:8:"textarea";}s:12:"image_source";a:3:{s:4:"body";s:48:"Name Placeholder 1, Insitution Placeholder, 2010";s:6:"format";s:0:"";s:5:"style";s:8:"textarea";}s:10:"focus_rect";s:0:"";s:9:"crop_rect";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:14:"First Creation";}
Maybe I have to build a proper array, but I am not sure how to do so.
Thank you for any hints!
Comment | File | Size | Author |
---|---|---|---|
Bildschirmfoto 2011-06-24 um 13.02.06.png | 53.87 KB | stefan81 |
Comments
Comment #1
fourmi4x CreditAttribution: fourmi4x commentedI have exactly the same problem... Did you manage to do this?
I also tried Passing Replacement Patterns no PHP code, but without success...
Comment #2
stefan81 CreditAttribution: stefan81 commentedHi
Here a few examples:
field_primary_image is my image field.
'image_caption' and 'image_source' are my extra fields
hope this helps
Comment #3
fourmi4x CreditAttribution: fourmi4x commentedHi, thanks for your answer. But for this snippet to work, I would have to do a node_load... ?