How to get #Tag Input Box in your Form

We all know what are #Tags in uKnowva. If you wish to get a tagInput in your web form, something like this,

Then, simply write this in your form code. Note: This works only for uKnowva 2.5.1 and above

echo uKnowvaUI::tagsInput('tags[]');

The function definition is as below:

/**
* this function returns an input field that can be displayed in a form where users can select # tags
* @param string $name
* name of the field
* @param string $selected
* default values to be selected
* @param array $taglist
* predefined list of tags to be shown
* @param array $options
* An array of options that can be configured as per JS file, refer https://harvesthq.github.io/chosen/
* @param array $attributes
* HTML element's attributes
* @return string the html that displays the taginput
*/
function tagsInput($name='tags[]', $selected = null, $taglist = null, $options = array(), $attributes = array()){}

On the server side, you need not save in a separate column in your database table, you can simply use uKnowvaTags::tagContent() function

if(!empty($data['tags'])){
if(!uKnowvaTags::tagContent($data['tags'],'article',$article->id,'com_content'))
JFactory::getApplication()->enqueueMessage(uKnowvaTags::$_errormsg);
}

Function definition of tagContent is:

/**
* tag a content
* @param array $tags is the array of tags,
* @param string $content_type will be the type of content like article, file, folder,
com_users, activity, comment, etc. Should not be more than 64 characters.
* @param int|string $content_id is a unique identifier of the content_type. example: file id, activity id, comment id, etc.
* @param string $option is the name of your component .i.e. com_users, com_uvwdocs, etc.
* @param array $taginfo can be an additional array which consist of other options tha you can set as defined in the #__tags table
* @return boolean true on success
*/
function tagContent($tags,$content_type,$content_id,$option=null,$taginfo = array()){}

{jcomments on}