views_handler_argument_node_type.inc

  1. 3.x modules/node/views_handler_argument_node_type.inc
  2. 2.x modules/node/views_handler_argument_node_type.inc

File

modules/node/views_handler_argument_node_type.inc
View source
  1. <?php
  2. /**
  3. * Argument handler to accept a node type.
  4. */
  5. class views_handler_argument_node_type extends views_handler_argument {
  6. function construct() {
  7. parent::construct('type');
  8. }
  9. /**
  10. * Override the behavior of summary_name(). Get the user friendly version
  11. * of the node type.
  12. */
  13. function summary_name($data) {
  14. return $this->node_type($data->{$this->name_alias});
  15. }
  16. /**
  17. * Override the behavior of title(). Get the user friendly version of the
  18. * node type.
  19. */
  20. function title() {
  21. return $this->node_type($this->argument);
  22. }
  23. function node_type($type) {
  24. $output = node_get_types('name', $type);
  25. if (empty($output)) {
  26. return t('Unknown node type');
  27. }
  28. else {
  29. return check_plain(t($output));
  30. }
  31. }
  32. }