views_handler_argument_locale_language.inc

  1. 3.x modules/locale/views_handler_argument_locale_language.inc
  2. 2.x modules/locale/views_handler_argument_locale_language.inc

Definition of views_handler_argument_locale_language.

File

modules/locale/views_handler_argument_locale_language.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_argument_locale_language.
  5. */
  6. /**
  7. * Argument handler to accept a language.
  8. *
  9. * @ingroup views_argument_handlers
  10. */
  11. class views_handler_argument_locale_language extends views_handler_argument {
  12. function construct() {
  13. parent::construct('language');
  14. }
  15. /**
  16. * Override the behavior of summary_name(). Get the user friendly version
  17. * of the language.
  18. */
  19. function summary_name($data) {
  20. return $this->locale_language($data->{$this->name_alias});
  21. }
  22. /**
  23. * Override the behavior of title(). Get the user friendly version
  24. * of the language.
  25. */
  26. function title() {
  27. return $this->locale_language($this->argument);
  28. }
  29. function locale_language($langcode) {
  30. $languages = views_language_list();
  31. return isset($languages[$langcode]) ? $languages[$langcode] : t('Unknown language');
  32. }
  33. }