Titles in Forms

How to add titles between form fields

To add titles between form fields use the type "title", to create a title that will make a separation in between forms use full_block = true, to use the title as part of the same form use full_block = false

 

addField([
   'type'=>'title', //required
   'value' => 'The text to display',  //required
   'full_block' => false, //optional, false by default
   'attributes'=>'', //optional
   'blockClass' => '', //optional, the class for the parent container
   'blockStyle' => '', //optional, the style for the parent container (without style="")
   'title' => '', //optional,value becomes the title when empty
   'icon'=> '<i class="fas fa-keyboard"></i>', //optional, keyboard by default
   'id'=>'', //optional (value becomes the ID when empty)
   'style' => 'color:red', //optional
   'class'=>'', //optional
   'dataString' => 'data-optional="some value"' //optional
]);

Database-derived title text

The title value is rendered as HTML. Escape database-derived plain text with htmlspecialchars($text, ENT_QUOTES, 'UTF-8') before passing it as the value. For an optional lookup label, append parentheses only when its value is neither null nor empty; build the complete plain-text title before escaping it. When adding page-owned HTML, escape its database text fragments individually.

Optional category-style color cues

Use the reusable kas-category-indicator class for a circular .85em cue with a small leading gap, baseline alignment and a subtle outline. Supply --kas-indicator-color only after validating an exact #RRGGBB value (case insensitive). Omit the cue for missing/invalid colors and omit the optional label and cue when unassigned. Keep the readable category label and mark the decorative span aria-hidden="true".

When the title value contains page-owned markup, provide an explicit stable id and an escaped plain-text title tooltip so Core does not derive identifiers or tooltips from HTML. CLIENT SUMMARY retains the category name in parentheses with its color cue immediately after the name.