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.
Hi, I tried using computed fields to generate a surrounding div around some fields.
OK, I have three field where I get the value[0] from and want to display them in my computed field.
$node_field[0]['value'] = $node->field_field1[0]['value'];
$node_field[1]['value'] = $node->field_field2[0]['value'];
$node_field[2]['value'] = $node->field_field3[0]['value'];
field1 contains a telephon number, field2 a fax number and field3 an email-adress.
I use disply field and as display format:
$display = $node_field_item['value'];
Datatyp is varchar and I enabled "storing in database"
As the result only the value of nod_field[0] is displayed.
What is wrong??
Regards
vistree
Comments
Comment #1
Moonshine CreditAttribution: Moonshine commentedWell this one is quite old, and not really a bug report, but on the off chance you're still interested. :)
My guess is that you're trying to store those multiple values in a computed field that's set to only accept 1 value. You'd want to take a look in the field settings for your computed field and make sure it's set for at least 3 values in your case.
FWIW though, if all you're looking to do is wrap a few fields in a div, then you really want to take a look at Drupal themeing a bit. You can make a change like that very easily in a template file rather then using computed fields.
Hope that helps...
Comment #2
mmjvb CreditAttribution: mmjvb as a volunteer commented