From a63427b8e235632050d5b2b2c7115dd500ae785a Mon Sep 17 00:00:00 2001
From: Brian Canini <canini.16@osu.edu>
Date: Wed, 7 Aug 2019 09:43:24 -0400
Subject: [PATCH] asc_bootstrap - theme hooks for research ct filters

---
 web/themes/asc_bootstrap/asc_bootstrap.theme | 28 +++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/web/themes/asc_bootstrap/asc_bootstrap.theme b/web/themes/asc_bootstrap/asc_bootstrap.theme
index dee8ebcc9b..ed531369ac 100755
--- a/web/themes/asc_bootstrap/asc_bootstrap.theme
+++ b/web/themes/asc_bootstrap/asc_bootstrap.theme
@@ -70,7 +70,7 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
   /*
   * events and news filters
   */
-  if (($form['#id'] == 'views-exposed-form-events-page-1')||($form['#id'] == 'views-exposed-form-news-page-1')) {
+  if (($form['#id'] == 'views-exposed-form-events-page-1')||($form['#id'] == 'views-exposed-form-news-page-1')||($form['#id'] == 'views-exposed-form-research-project-directory-page-1')) {
     /*
     * add new HTML content to filters (headers and spacer)
     * and setting weights for where they should appear in the form hierarchy
@@ -117,6 +117,32 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
     if(count($form['field_news_terms_2_target_id']['#options']) == 1) {
       $form['field_news_terms_2_target_id']['#access'] = FALSE;
     }
+
+    if(count($form['field_research_departments_target_id']['#options']) == 1) {
+      $form['field_research_departments_target_id']['#access'] = FALSE;
+    }
+
+    if(count($form['field_research_other_target_id']['#options']) == 1) {
+      $form['field_research_other_target_id']['#access'] = FALSE;
+    }
+
+    if(count($form['field_research_year_target_id']['#options']) == 1) {
+      $form['field_research_year_target_id']['#access'] = FALSE;
+    }
+    /*
+    * research filters - setting default value on select box to taxonomy vocabulary
+    */
+    if(count($form['field_research_departments_target_id']['#options']['#value']) == "All") {
+      $form['field_research_departments_target_id']['#options']['All'] = $form['#info']['filter-field_research_departments_target_id']['label'];
+    }
+
+    if(count($form['field_research_other_target_id']['#options']['#value']) == "All") {
+      $form['field_research_other_target_id']['#options']['All'] = $form['#info']['filter-field_research_other_target_id']['label'];
+    }
+
+    if(count($form['field_research_year_target_id']['#options']['#value']) == "All") {
+      $form['field_research_year_target_id']['#options']['All'] = $form['#info']['filter-field_research_year_target_id']['label'];
+    }
   }
 
   /*
-- 
GitLab