location_handler_argument_location_province.inc 908 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Argument handler to accept a province code or name.
  4. */
  5. class location_handler_argument_location_province extends views_handler_argument {
  6. /**
  7. * Override the behavior of title(). Get the province name.
  8. */
  9. function title() {
  10. if (isset($this->view->argument['country'])) {
  11. $country = $this->view->argument['country']->argument;
  12. }
  13. else {
  14. $country = variable_get('location_default_country', 'us');
  15. }
  16. return location_province_name($country, $this->argument);
  17. }
  18. function summary_name($data) {
  19. $value = $data->{$this->name_alias};
  20. if (empty($value)) {
  21. return t('Unknown');
  22. }
  23. if (isset($this->view->argument['country'])) {
  24. $country = $this->view->argument['country']->argument;
  25. }
  26. else {
  27. $country = variable_get('location_default_country', 'us');
  28. }
  29. return location_province_name($country, $value);
  30. }
  31. }