Skip to content

Heading Field

Overview

The heading field is used to display a heading within your interface. You can also extend this field to include additional types like subheading or submessage in the future. This allows for flexibility and adaptability to different content needs.

Field Configuration

Below is the general structure for defining a heading field:

php
array(
    'type'    => 'heading',
    'content' => 'This is a heading'
),

Specific Parameters

ParameterTypeDefaultDescription
contentstring-Content for the heading section.
tagstringh3HTML tag for the heading. (e.g., h1, h2, h3, h4,h5, h6,)
classstringcmf--headingSpecific CSS Class for heading.

General Parameters

ParameterTypeDefaultDescription
idstring-Unique identifier for the field.
typestring-Defines the field type.
titlestring-The title displayed for the field.
subtitlestring-The text displayed under the title.
classstring-Field additional class.
data_typestringserializeDefines how data is stored (e.g., serialize).
namestring-Custom name for the field.
placeholderstringNot selectedPlaceholder text for the input.
attributesarrayarray()Custom HTML attributes.
beforestring-Content to display before the field.
afterstring-Content to display after the field.
descriptionstring-A detailed description of the field.
descstring-A short description, used if description is not set.
helpstring-Additional helper text for guidance. Usually show on the top right corner of the field.
errorstring-Error message to display when validation fails.
dependenciesarray-Show/Hide a field base on another field value.

Example Usage

Here’s an example of how a heading field might be defined in a settings panel:

php
array(
    'id'      => 'example_heading',
    'type'    => 'heading',
    'content' => 'This is a heading for section',
),

Notes

  • The content can be a string of any length, and it will be rendered as a text value within the interface.
  • Keep an eye out for future updates that may introduce more types to further enhance content customization.