Drupal Association members fund grants that make connections all over the world.
When I look at CCK field data, very often the field has multiple attributes for each field item. For instance (using Devel's Dev Load node inspector):
field_portfolio_image (Array, 1 element)
- 0 (Array, 3 elements)
- - fid (String, 3 characters ) 370
- - uid (String, 1 characters ) 1
- - data (Array, 2 elements)
- - - description (String, 0 characters )
- - - alt (String, 0 characters )
This field has many different attributes and values (even nested arrays with more values) for each item.
With a CF field, while I can create multiple items, each item is limited to a single attribiute: 'value:'
field_computed_youtube (Array, 1 element)
- 0 (Array, 1 element)
- - value (String, 27 characters ) http://youtu.be/xxxxxxxx
I've even set additional attributes in the CF PHP field, like this:
$node_field['title'] = "Title of Video"; $node_field['width'] = "600px"; $node_field['height'] = "400px"; $node_field['value'] = $url;
But when the node is saved only the 'value' attribute is written to the node (see output above).
Why can't we use this module to set other attributes? Am I missing something? I've seen no examples where people attempt to do this, so perhaps this module cannot handle writing more than a single value to a field item...
Still couldn't find anything that forces Computed Field to hold anything besides the single 'value' attribute, but I did find that...
- serializing an associative array like the example code above,
- setting that serialized string as the ['value'] value,
- and using the Computed Field Display override function to unserialize and access that array works.
It's very unwieldy though, and I'm still interested in any clean-cut solutions or patches.