public function getInput($fieldValue = null) { if (!$this->isPublished()) { return ""; } if ($this->params->get("tag_search", 0)) { $document = JFactory::getDocument(); JUDirectoryFrontHelper::loadjQueryUI(); $document->addStyleSheet(JUri::root(true) . "/components/com_judirectory/assets/css/tagit-style.css"); $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/js/tagit.js"); $tagScript = ' jQuery(document).ready(function($){ $("#' . $this->getId() . '_tags").tagit({ tagSource:' . ($this->params->get('auto_suggest') ? $this->getTags() : '[]') . ', initialTags: ' . $this->getInitialTags($fieldValue) . ', tagsChanged: function(){ getTags($("#' . $this->getId() . '_tags").tagit("tags")); }, triggerKeys:["enter", "comma", "tab"], minLength: 3, maxLength: 50, maxTags: 50, sortable: "handle", placeholder: " ' . $this->params->get("placeholder", "") . ' " }); function getTags(tags) { var newtags = []; for (var i in tags){ if (tags[i].label != undefined ){ var tagvalue = tags[i].value.replace("|", ""); newtags.push(tagvalue); $(tags[i].element[0]).find(".tagit-label").text(tagvalue); } } var newtags_str = newtags.join(","); $("#' . $this->getId() . '").val(newtags_str); } }); '; $document->addScriptDeclaration($tagScript); $this->params->set("auto_suggest", 0); $this->params->set("regex", ""); $value = !is_null($fieldValue) ? $fieldValue : $this->value; $this->setVariable('value', $value); return $this->fetch('input.php', __CLASS__); } else { return parent::getInput($fieldValue); } }