Sections
Introduction
The sections
component allows you to organize your form fields.
protected $sections = [
'database' => [
'title' => 'Database Information',
'fields' => [
'database_driver',
'database_host',
'database_name',
'database_username',
'database_password'
]
],
'administrator' => [
'title' => 'Admin Information',
'fields' => [
'admin_username',
'admin_email',
'admin_password'
]
],
];
Key | Required | Type | Default | Description |
---|---|---|---|---|
slug | true | string | The definition key. | The section slug can be used to reference the section later. |
title | false | string | {vendor}.module.{module}::{slug}.title | The section title. |
description | false | string | {vendor}.module.{module}::{slug}.description | The section description. |
fields | false | array | null | The section fields. |
tabs | false | array | null | The section tab definitions. See below for more information. |
attributes | false | array | null | An array of key => value HTML attributes. Any base level definition keys starting with data- will be pushed into attributes automatically. |
view | false | string | null | The view to delegate the section to. |
Tabs
Tabs are a specific type of section.
protected $sections = [
'general' => [
'tabs' => [
'form' => [
'title' => 'module::tab.form',
'fields' => [
'form_name',
'form_slug',
'form_description',
'success_message',
'success_redirect'
]
],
'notification' => [
'title' => 'module::tab.notification',
'fields' => [
'send_notification',
'notification',
'notification_send_to',
'notification_cc',
'notification_bcc'
]
],
]
]
];
Key | Required | Type | Default | Description |
---|---|---|---|---|
slug | true | string | The definition key. | The tab slug is used in it's HTML markup as part of an ID. |
title | true | string | none | The tab title. |
stacked | false | boolean | false |
If true then tabs will stack vertically. |
fields | false | array | null | The tab fields. |
Views
You can delegate sections to views
by specifying the view
key in your section.
protected $sections = [
'general' => [
'view' => 'module::form/general',
],
'advanced' => [
'view' => 'module::form/advanced',
],
];