Structuring, storing, and accessing content

Fields are the heart and soul of Enact. They enable the definition, storage, and access of content used within the CMS.

Out of the box Enact comes with 16 fields:

  1. Assets

  2. Checkboxes

  3. Color

  4. Date Or Time

  5. Dropdown

  6. Entries

  7. Lightswitch

  8. Matrix

  9. Number

  10. Plain Text

  11. Radio Buttons

  12. Rich Text

  13. Table

  14. Tags

  15. Users

  16. Video

Fields are created via the fields control panel and are organized into field groups. Individual fields and whole field groups can then be assigned to section layouts to compose the types of content accepted by entries within the section using the specified section layout.

The three components of a field#

Fields are composed of three distinct parts:

1. Field creation/definition :

  • Field group – The field group the field belongs to.

  • Name – The name of the field

  • Handle – The handle of the field (how you access it via templates)

  • Instructions – Instructions to content creators about the field and how to use it.

  • Required – Whether or not the field must be given a value to be used.

  • Field Type – The type of content the field will hold.

  • Options – Options that are specific to the type of field being created.

2. Use context : How the field is presented to content creators using it in a layout. For example the 'Rich Text' field is a large text area input that has controls for manipulating HTML as a WYSIWYG, and the Radio Buttons field is a grouping of radio button inputs that only allows the content creators to select 1 of the buttons.


3. Template use : How the fields can be used in your twig section template files. A fields use is defined by the methods and properties provided by the PHP class representing each field. For example, the 'Asset' field has a method getImgHtml which returns an <img> element with the src and title properties set to the appropriate values based on the value of the field.