diff --git a/includes/flag_lists_handler_filter_template.inc b/includes/flag_lists_handler_filter_template.inc index a39d829..5cc88a7 100644 --- a/includes/flag_lists_handler_filter_template.inc +++ b/includes/flag_lists_handler_filter_template.inc @@ -7,11 +7,27 @@ class flag_lists_handler_filter_template extends views_handler_filter_in_operato function get_value_options() { if (!isset($this->value_options)) { $this->value_title = t('List templates'); + $this->value_options = array(); $templates = flag_lists_get_templates(); - foreach ($templates as $template) { - $options[$template->name] = $template->name; + if (empty($templates)) { + drupal_set_message( + t('No templates found, create a flag lists template', + array('@url' => url('/admin/structure/flags/lists/template') )), + 'info'); + } + else if ($templates['0'] === FALSE) { + drupal_set_message( + t('No enabled template found, enable the built in flag lists template', + array('@url' => url('/admin/structure/flags/manage/fl_template') )), + 'warning'); + } + else { + foreach ($templates as $template) { + $options[$template->name] = $template->name; + } + $this->value_options = $options; } - $this->value_options = $options; } + return $this->value_options; } }