flag_lists_handler_filter_template.inc 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @file flag_lists_handler_filter_template.inc
  4. * Filter by list template
  5. */
  6. class flag_lists_handler_filter_template extends views_handler_filter_in_operator {
  7. function get_value_options() {
  8. if (!isset($this->value_options)) {
  9. $this->value_title = t('List templates');
  10. $this->value_options = array();
  11. $templates = flag_lists_get_templates();
  12. if (empty($templates)) {
  13. drupal_set_message(
  14. t('No templates found, create a flag lists <a href="@url">template</a>',
  15. array('@url' => url('/admin/structure/flags/lists/template') )),
  16. 'info');
  17. }
  18. else if ($templates['0'] === FALSE) {
  19. drupal_set_message(
  20. t('No enabled template found, enable the built in flag lists <a href="@url">template</a>',
  21. array('@url' => url('/admin/structure/flags/manage/fl_template') )),
  22. 'warning');
  23. }
  24. else {
  25. foreach ($templates as $template) {
  26. $options[$template->name] = $template->name;
  27. }
  28. $this->value_options = $options;
  29. }
  30. }
  31. return $this->value_options;
  32. }
  33. }