Skip to content
Steve Pfisterer edited this page May 13, 2016 · 13 revisions

Fields

Fields are very easy to add to a field group. There is very general addField($name, $args = []) method that will accept a name (to be in lowercase and underscores) and an array of field configurations that can be found on the ACF register fields via PHP page. If you don't specify a type option, ACF will default to a normal text field.

Luckily the ACF Builder library provides a number of self descriptive shortcut functions for adding different field types. The best way to see all the available field type functions in the FieldsBuilder.php class file, and their options correlate to those defined by ACF

If you're using a 3rd party ACF plugin that adds additional field types, you can just use the generic addField function and pass the field type to the $args array.

Clone this wiki locally