CRM-19769 - Add select2 widget to display tags in color
[civicrm-core.git] / CRM / Case / Form / Case.php
index 76c61baaf54b87f48c0ee5313170fb7d7825f806..f236b23dab0df199dbafb1fe69dda338812ccbb6 100644 (file)
@@ -244,12 +244,11 @@ class CRM_Case_Form_Case extends CRM_Core_Form {
       )), TRUE
     );
 
-    CRM_Core_BAO_Tag::getTags('civicrm_case', $tags, NULL,
-      '  ', TRUE);
+    $tags = CRM_Core_BAO_Tag::getColorTags('civicrm_case');
 
     if (!empty($tags)) {
-      $this->add('select', 'tag', ts('Select Tags'), $tags, FALSE,
-        array('id' => 'tags', 'multiple' => 'multiple', 'class' => 'crm-select2')
+      $this->add('select2', 'tag', ts('Tags'), $tags, FALSE,
+        array('class' => 'huge', 'multiple' => 'multiple')
       );
     }
 
@@ -371,6 +370,9 @@ class CRM_Case_Form_Case extends CRM_Core_Form {
     $tagParams = array();
     if (!empty($params['tag'])) {
       $tagParams = array();
+      if (!is_array($params['tag'])) {
+        $params['tag'] = explode(',', $params['tag']);
+      }
       foreach ($params['tag'] as $tag) {
         $tagParams[$tag] = 1;
       }