• Page:
  • 1

Tags Input in custom profile fields

ONLINE

Tags Input in custom profile fields

2 months, 1 week ago
Hi All,

If you want Tags Input Box in your uknowva's custom fields. And you are using an old version of uknowva. Which you can't update. You can use the follow the below mentioned steps to create Tags Input Box -

1. Create a tags.xml with following code -
<?xml version="1.0" encoding="utf-8"?>
<config>
	<params>
		<param name="@spacer" type="spacer" default="" label="" description="" />
		<param name="size" type="text" default="" label="Size" description="" />
		<param name="style" type="text" default="" label="Style Attribute" description="" />
		<param name="class" type="text" default="" label="Additional class" description="" />
	</params>
</config>

2. Create a tags.php with following code -
defined('_JEXEC') or die('Restricted access');

require_once (COMMUNITY_COM_PATH.DS.'libraries'.DS.'fields'.DS.'profilefield.php');
class CFieldsTags extends CProfileField
{
	public function getFieldHTML( $field , $required, $isDropDown = true)
	{
		$selected = explode(',',$field->value);
		echo uKnowvaUI::tagsInput('field'.$field->id.'[]',$selected);
	}
	public function formatdata($value)
	{
		$finalvalue = array();
		if(!empty($value))
		{
			foreach($value as $listValue){
				$finalvalue[] = $listValue;
			}
		}	
		return implode(",",$finalvalue);	
	}
}


3. Upload both these files in Path /public_html/components/com_community/libraries/fields and than open file customfields.xml. And just the add these below code under the fields section (<fields> tag) -
<field>
	<type>tags</type>
	<name>Tags List</name>
</field>


After these 3 steps you will see. Tags List type while you add new custom field.

Use this for increase tagging.

Thanks
The following user(s) said Thank You: Vicky Jain, Neemit Shastri
  • Page:
  • 1

Upcoming Events

Who's Online