DOCUMENTATION

  • Developer
  • Field Types
Search »

Custom Fields

Adding Field Types

Adding a field type
Adding a field type

Adding a new field type is very simple. After selecting the module, click the appropriate "Add Field Type ยป" link, found at the bottom right of the field type groups. That will open a dialog window that looks like the screenshot to the right. Here's what the fields mean.

Field Name. This is a string that best describes your field type (e.g. "Modified textbox", "Calendar widget" or whatever is most appropriate). It doesn't have to be unique, but we strongly suggest you name it something different to what's already defined!

Field Type Identifier. This field must be unique. In the database, field types are stored in the [prefix]field_types table, which uses an auto-increment column to identify and reference them in the code. This numeric ID may be different for each installation, so instead, this field allows you to provide a simple, human-friendly string to identify your field type. There are functions in the Form Tools code base (such as ft_get_field_type_by_identifier()) that allow you to reference field types by their string ID instead their auto-increment value. This field must be alphanumeric, and should be lower-case for consistency. This value cannot be changed after you define it here.

Group. The group to which the field type belongs. You can group them however you want through the Custom Fields main page.

Base field type on... This is a simple time-saving device. It creates a new field type with all of the exact settings of another. Please note, however, that for non-Core field types (i.e. field types defined through separate modules), this will not copy over any template or code hooks defined. So don't be surprised if you make a copy of the Google Maps field type and find that your new version doesn't work!

After you have created your new field type, you'll be redirected to the edit section where you can customize it. For information on that, see the upcoming Editing Field Types section.