location_views_handler_field_latitude.inc 909 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * @file
  4. * Latitude field handler.
  5. */
  6. class location_views_handler_field_latitude extends views_handler_field {
  7. function option_definition() {
  8. $options = parent::option_definition();
  9. $options['style'] = array('default' => 'dms');
  10. return $options;
  11. }
  12. function options_form(&$form, &$form_state) {
  13. parent::options_form($form, $form_state);
  14. $form['style'] = array(
  15. '#title' => t('Display style'),
  16. '#type' => 'select',
  17. '#options' => array(
  18. 'dd' => t('Decimal degrees'),
  19. 'dms' => t('Degrees, minutes, seconds'),
  20. ),
  21. '#default_value' => $this->options['style'],
  22. );
  23. }
  24. function render($values) {
  25. if ($this->options['style'] == 'dd') {
  26. return check_plain($values->{$this->field_alias});
  27. }
  28. else {
  29. return theme('location_latitude_dms', array('latitude' => $values->{$this->field_alias}));
  30. }
  31. }
  32. }