location_handler_field_location_address.inc 909 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * @file
  4. * Field handler to display a complete address.
  5. */
  6. class location_handler_field_location_address extends views_handler_field {
  7. function option_definition() {
  8. $options = parent::option_definition();
  9. $options['hide'] = array('default' => array());
  10. return $options;
  11. }
  12. function options_form(&$form, &$form_state) {
  13. parent::options_form($form, $form_state);
  14. $form['hide'] = array(
  15. '#type' => 'checkboxes',
  16. '#title' => t('Hide fields from display'),
  17. '#options' => location_field_names(TRUE),
  18. '#default_value' => $this->options['hide'],
  19. );
  20. }
  21. function render($values) {
  22. if ($values->{$this->field_alias}) {
  23. $location = location_load_location($values->{$this->field_alias});
  24. if ($location['lid']) {
  25. return theme('location', array('location' => $location, 'hide' => $this->options['hide']));
  26. }
  27. }
  28. }
  29. }