Commits

Manel Monguilod committed 4337d27

Delete duplicate tags when add an array of tags to the item

Comments (0)

Files changed (1)

lib/behavior/TaggableBehavior.php

  */
 public function addTags(\$tags) {
     \$arrTags = is_string(\$tags) ? explode(',', \$tags) : \$tags;
-
+        // Remove duplicate tags. 
+    \$arrTags = array_intersect_key(\$arrTags, array_unique(array_map('strtolower', \$arrTags)));
     foreach (\$arrTags as \$tag) {
         \$tag = trim(\$tag);
         if (\$tag == \"\") return;