entity_translation_handler_filter_entity_type.inc 858 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @file
  4. * Contains an entity type filter handler.
  5. */
  6. /**
  7. * This handler shows all available entity types that are enabled for entity
  8. * translation as options.
  9. */
  10. class entity_translation_handler_filter_entity_type extends views_handler_filter_in_operator {
  11. /**
  12. * Show all entity types that are enabled for entity translation as options.
  13. */
  14. function get_value_options() {
  15. if (!isset($this->value_options)) {
  16. $this->value_title = t('Entity type');
  17. $allowed_types_options = variable_get('entity_translation_entity_types');
  18. $allowed_types = array();
  19. $entity_info = entity_get_info();
  20. foreach ($allowed_types_options as $key => $allowed) {
  21. if ($allowed) {
  22. $allowed_types[$key] = $entity_info[$key]['label'];
  23. }
  24. }
  25. $this->value_options = $allowed_types;
  26. }
  27. }
  28. }