Support

  1. GrafAtRuss
  2. General
  3. Thursday, April 28 2022, 03:56 PM
Good day.
Can you please tell me how to make my own field type?
I need to clone the text field, but so that the information I set is displayed in the interface based on the data entered by the user.
admin Accepted Answer
Admin
Hi,
all field types's definitition are into folder /administrator/components/com_jsn/helpers/fields/, you can take a simple field type like "text" and create a new type.

About layout or Joomla field types you can refer to Joomla documentation.

I know that I am giving you a somewhat generic answer, but in fact the easy profile's fields use an XML declaration used by Joomla Forms and the Joomla field types (some native and others created by us which mostly extend native fields)
  1. more than a month ago
  2. General
  3. # 1
GrafAtRuss Accepted Answer
Please help me write the fields. I cloned the scripts and started writing link generation. But I can’t figure out how to get the settings from the xml?

<field
name="account_path"
label="COM_JSN_ACCOUNT_PATH"
description ="COM_JSN_ACCOUNT_PATH_DESC"
type="text"
/>

<field
name="account_window"
label="COM_JSN_ACCOUNT_WINDOW"
description ="COM_JSN_ACCOUNT_WINDOW_DESC"
class="btn-group"
type="radio"
default="_blank"
>
<option value="_self">JNO</option>
<option value="_blank">JYES</option>
</field>



public static function account($field)
{
//require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$value=$field->__get('value');
//$accountPath=JsnHelper::getFieldOptions($alias);
$path=$field->element[0];

if (empty($value))
{
return JHtml::_('users.value', $value);
}
else
{
JPluginHelper::importPlugin('content');
return JHtml::_('content.prepare', '<a href="'.$path.'/'.$value.'" target="'.$target.'">'.$value.' '.$path.'</a>', '', 'jsn_content.content');
}
}
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
you can use a code like this:
public static function account($field)
{
if (empty($value))
{
return JHtml::_('users.value', $value);
}
else
{
if(method_exists($field,'getAttribute')){ /* This is necessary because in some point Joomla can call this static function but not pass $field as instance of JField */
$accountPath = $field->getAttribute('attribute_name_used_in_function_getXml');
// HERE THE CODE
}
else return $value;
}
}
  1. more than a month ago
  2. General
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.