This document will discuss the rest of the methods available in mFieldType class.
isRequired()
Determine whether a custom field is set as a 'Required' field. isRequired will return TRUE if a custom field is set to 'Required' and return FALSE is otherwise.
isCore()
Determine whether a custom field is a Core field. isCore() will return TRUE if a custom field is A Core field and return FALSE if otherwise.
inBackEnd()
Determine if during run time, it is executing in front-end of back-end. This is mostly useful when use in getInputHTML() to present present different output in front or back-end. inBackEnd() returns TRUE if in back-end and FALSE if otherwise.
hasValue()
Determine whther a custom field has value. The value refers here is the value stored in database. If there is no value stored for a custom field, hasValue() will return FALSE. It will return TRUE if it has value.
hasInputField()
Field Types do not necessary need to have input fields. In such cases, you'll need to initialize $numOfInputFields to 0 and hasInputField() will return FALSE. Field Types that accepts multiple values such as Date Field Type has $numOfInputFields set to a number more than 1 (for Date field type, this is set to 3). By default $numOfInputFields is set to 1.
hasSearchField()
Not all field types have to be searchable. In such cases, you'll need to initialize $numOfSearchFields to 0 and hasSearchField() will return FALSE. By default $numOfSearchFields is set to 1.
hasCaption()
Determine whether a custom field has caption. If a custom field does not have caption or is set to hide caption, hasCaption() will return FALSE. hasCaption returns TRUE is a custom field has caption and the caption is not hidden.
hasJSValidation()
Determine if a custom field has a custom javascript validation declared in getJSValidation(). hasJSValidation() returns TRUE if getJSValidation() does not return empty string and does not return null.
getId()
Returns a custom field's unique ID. This ID can also be found in Custom Fields sections in Mosets Tree's back-end under 'ID' column.
getLinkId()
Returns a link or listing's ID.
getParam(string $key, string $default)
With each field type, you can attach a XML file named params.xml that contains configurable options for custom fields. params.xml used by field type is similar to the one created for Joomla's module. getParam() allows you to retrieve individual configuration for a custom field. $key parameter is the name of a parameter. $default is the default value for the parameter if no configuration is set by user.
getFieldType()
Returns the name of a field type.
getValue(int $arg)
Returns the data stored in database of a custom field. When $arg argument is given, it will return then $arg-nth value of a pipe (|) separated data. For example if a custom field data is '13|June|2007', getValue(2) will return 'June'. For custom field that accepts file upload, getValue will return the file name of the uploaded file, otherwise it will return an empty string.
getSize()
Returns the size configured by user for a custom field. Returns an empty string if no size is entered by user.
getFieldElements()
Returns field elements configured by user for a custom field. Returns an empty string if no field element is entered by user.
getArrayFieldElements()
Returns an array of field elements.
getName()
Returns the name of a custom field for use in INPUT tag.
getInputFieldName(int $count)
This method is an extension of getName() in that it allows you to create multiple unique field names for field type that uses more than one INPUT field. getInputFieldName($count) will append the original field name with an underscore follows by an integer passed through the $count count argument. For example, if a field name is cf24, getInputFieldName(1) will returns cf24_1. This method simply provides you with a standard method to create these names and does nothing more than that. However it is important to follow this naming convention in order for Mosets Tree to recognize these input fields as part of a custom field.
getCaption()
Returns the caption of a custom field.
getModPrefixText()
Returns the prefix text that displays during field modification.
getModSuffixText()
Returns the suffix text that displays during field modification.
getDisplayPrefixText()
Returns the prefix text that displays during field output.
getDisplaySuffixText()
Returns the suffix text that displays during field output.
getFieldTypeAttachmentURL( string $arg )
With each field type, you can attach additional file(s) for use within the field. This can be a javascript, flash, images or any file types. You need to pass the file name of an attachment as the argument to get the URL. eg:
$this->getFieldTypeAttachmentURL('player.swf'); // returns http://www.example.com/components/com_mtree/attachment.php?ft=audioplayer&file=player.swf' getDataAttachmentURL()
Returns the URL of an uploaded file through a custom field. eg:
$this->getDataAttachmentURL(); // returns http://www.example.com/components/com_mtree/attachment.php?link_id=3&cf_id=24
Regardless of whether the custom field has an uploaded file, getDataAttachmentURL will return a URL with a unique combination of link_id and cf_id. You will need to use $this->hasValue() to check if a custom field has been populated.
getSearchFieldName(int $count))
Returns a unique name for a search field's INPUT tag. If invoked without an argument (or with an argument 1), it will return the name of the field, same as the output when calling getName(). The optional argument, $count, allows you to pass an integer (starting from 2) and returns additional search field name. The naming convention used here is the same as getInputFieldName.
getKeepFileName()
When a custom field stores an uploaded file in a listing, subsequent modification to the listing will presents a checkbox to allow user to delete the file from the custom field. getKeepFileName() returns the INPUT field name for this checkbox.
getKeepFileRadioHTML()
Returns the HTML tags needed for the Keep File checkbox as discussed above. By default, it presents a checkbox with a checked attribute. This method is mostly used in getKeepFileCheckboxHTML method.
function getKeepFileCheckboxHTML($hasAttachment=1) { return ''; }