tmgmt_node_handler_filter_node_translatable_types.inc 814 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @file
  4. * Contains tmgmt_node_ui_handler_filter_node_translatable_types.
  5. */
  6. /**
  7. * Limits node types to those enabled for content translation.
  8. */
  9. class tmgmt_node_ui_handler_filter_node_translatable_types extends views_handler_filter {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. function query() {
  14. $this->ensure_my_table();
  15. $valid_types = array_keys(tmgmt_source_translatable_item_types('node'));
  16. if ($valid_types) {
  17. $this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", array_values($valid_types), 'IN');
  18. }
  19. else {
  20. // There are no valid translatable node types, do not return any results.
  21. $this->query->add_where_expression($this->options['group'], '1 = 0');
  22. }
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. function admin_summary() { }
  28. }