Registering Fields

Field Settings

The $_settings property accepts an array of settings, following an array format shared with Actions.

For a list of accepted settings properties and a list of basic settings, see the article on Settings Configuration.

Field Templates

Fields Templates are output to the page as Backbone/Underscore templates.

Each field template is defined in HTML, loaded with PHP, then passed to the JavaScript at page render.

The template markup should be wrapped in script tags, identified with the id nf-tmpl-field-[type].


<script id='nf-tmpl-field-input' type='text/template'>
<input id="nf-field-<%= id %>" name="nf-field-<%= id %>" class="<%= classes %> nf-element" type="text" value="<%= value %>" placeholder="<%= placeholder %>">

Template Loading Hierarchy

The template files are loaded using a hierarchical system, similar to WordPress theme templates.

The order is as follows:

  1. Theme Directory – “[theme folder]/ninja-forms/templates/”
  2. Filtered Directories -nf_field_template_file_paths
  3. Templates Directory – “includes/Templates”