Access of Location data for use ina computed field

Events happening in the community are now at Drupal community events on www.drupal.org.
husainsn's picture

Hello
I have node type with location data. I want to access latitude and longitude data to calculate Sunrise time in a computed field - but no success. The code in computed field (on the same node) is:

$lat = $node->$location[latitude];
$long = $node->$location[longitude];
$node_field[0]['value'] = date_sunrise(time(), SUNFUNCS_RET_STRING, $lat, $long, 90, -5);

I can access latitude data $location[latitude] in the theme override.

Any help will be appreciated.

Comments

Module weight?

raintonr's picture

I'm just guessing, but this could be something to do with module weight. You'd have to have the computed field module lower down the execution order than location for it to be able to access location's fields.

Or then again, that could be way off-base but it's worth a look and a slight tweak?

Thanks, but no joy

husainsn's picture

Could one have to refer $location[latitude] differently?

Shifting module weights?

mk3's picture

How I can shift module/CCK field weights cause I think I have similar problem while accesing field values which as dev load shows is loading later than my computed field. I think thats what causing problems with getting empty computed field.

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: