Closed (fixed)
Project:
Radioactivity
Version:
7.x-2.7
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Sep 2012 at 20:58 UTC
Updated:
19 Oct 2012 at 18:05 UTC
Sorry, this is a super stupid problem but I'm new to PHP and can't solve it myself.
On my node I have an energy field and a computed field. The computed field is supposed to read out the node's current energy, plug it into a function and return another value.
I have tried all of
float( $entity->field_energy ),
float( $entity->field_energy[0]['value'] ), and
float( array_pop(array_pop(field_get_items($entity_type, $entity, 'field_energy'))) )
to read out the node's current energy, but everythings gives me an error. When I replace the reading-out-formulas with a static number everything works fine.
Can anyone tell me how to read out the energy and turn it into a real number?
Comments
Comment #1
jaxxed commentedSorry for the delay,
If you are still looking working on your problem, this will give you a hard to read, but output of the variable.
If you have the devel module installed, this would be much easier to read:
I can't rememeber if Radioactivity uses a straight 'value' field value, but quickly looking at your question, I would say that your float() syntax is not right. PHP doesn't cast using such functions.
Comment #2
semei commentedThank you! I ended up getting
$entity->field_energy['und'][0]['radioactivity_energy']to work.