views_handler_argument_group_by_numeric.inc 831 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_argument_group_by_numeric.
  5. */
  6. /**
  7. * Simple handler for arguments using group by.
  8. *
  9. * @ingroup views_argument_handlers
  10. */
  11. class views_handler_argument_group_by_numeric extends views_handler_argument {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public function query($group_by = FALSE) {
  16. $this->ensure_my_table();
  17. $field = $this->get_field();
  18. $placeholder = $this->placeholder();
  19. $this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument));
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function ui_name($short = FALSE) {
  25. return $this->get_field(parent::ui_name($short));
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function get_sort_name() {
  31. return t('Numerical', array(), array('context' => 'Sort order'));
  32. }
  33. }