geocoder.api.php 797 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Implements hook_entity_property_info_alter().
  4. *
  5. * Give Users a virtual property that contains all relevant address information from multiple sources.
  6. */
  7. function YOURMOD_entity_property_info_alter(&$info) {
  8. $info['user']['bundles']['user']['properties']['full_address'] = array(
  9. 'type' => 'text',
  10. 'label' => 'Full adress (from other fields)',
  11. 'getter callback' => 'YOURMOD_user_full_address',
  12. );
  13. }
  14. /**
  15. * Entity property callback for user.full_address.
  16. *
  17. * field_address is a text field, and when combined with a variable makes the full address.
  18. */
  19. function YOURMOD_user_full_address($entity, $options, $field, $entity_type, $property) {
  20. return $entity->field_address[LANGUAGE_NONE][0]['value'] . ', ' . variable_get('YOURMOD_global_country', 'Zimbabwe');
  21. }