diff --git a/docs/dev/reference/dca/fields.md b/docs/dev/reference/dca/fields.md index e01389ab8..0d9098a54 100644 --- a/docs/dev/reference/dca/fields.md +++ b/docs/dev/reference/dca/fields.md @@ -27,31 +27,31 @@ $GLOBALS['TL_DCA']['tl_example']['fields']['myfield'] = [ ## Reference -| Key | Value | Description | -|:---------------------|:------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| label | `&$GLOBALS['TL_LANG']` (`array`) | Field label. Typically a reference to the global language array. Needs to be an array containing two elements: the field's label and its description.1 | -| default | Default value (`mixed`) | Default value that is set when a new record is created. | -| exclude | true/false (`bool`) | If true the field will be excluded for non-admins. It can be enabled in the user group module (allowed excluded fields). | -| toggle | true/false (`bool`) | {{< version-tag "4.13" >}} If true the field can be used to trigger the `toggle` action. -| search | true/false (`bool`) | If true the field will be included in the search menu (see "sorting records" -> "panelLayout"). | -| sorting | true/false (`bool`) | If true the field will be included in the sorting menu (see "sorting records" -> "panelLayout"). | -| filter | true/false (`bool`) | If true the field will be included in the filter menu (see "sorting records" -> "panelLayout"). | -| flag | Sorting mode (`integer`) | **1** Sort by initial letter ascending
**2** Sort by initial letter descending
**3** Sort by initial X letters ascending (see length)
**4** Sort by initial X letters descending (see length)
**5** Sort by day ascending
**6** Sort by day descending
**7** Sort by month ascending
**8** Sort by month descending
**9** Sort by year ascending
**10** Sort by year descending
**11** Sort ascending
**12** Sort descending

Note: flags 5 through 10 will also enable formatting of timestamps in the back end when used as a label somewhere. | -| length | Sorting length (`integer`) | Allows to specify the number of characters that are used to build sorting groups (flag **3** and **4**). | -| inputType | Field type (`string`) | [`checkbox`][CheckboxWidget] Checkbox
[`checkboxWizard`][CheckboxWizardWidget] Checkbox Wizard
[`chmod`][ChmodWidget] CHMOD table
[`fileTree`][FileTreeWidget] File tree
`imageSize` Two text fields with drop-down menu (creates an [Image Size Array](/framework/image-processing/image-sizes/#size-array))
`inputUnit` Text field with small unit drop-down menu
`keyValueWizard` Key » Value wizard
[`listWizard`][ListWizardWidget] List wizard
`metaWizard` Used for setting meta information in the file manager
`moduleWizard` Module wizard
`optionWizard` Option wizard
`pageTree` Page tree
`password` Password field
[`picker`][PickerWidget] General purpose picker
`radio` Radio button
`radioTable` Table with images and radio buttons
`sectionWizard` Used for defining sections in the page layout
[`select`][SelectWidget] Drop-down menu
`serpPreview` Search Engine Result Preview (SERP) widget
`tableWizard` Table wizard
`text` Text field
`textStore` Text field that will not display its current value
[`textarea`][TextareaWidget] Textarea
`timePeriod` Text field with drop-down menu
`trbl` Four text fields with a small unit drop-down menu | -| options | Options (`array`) | Options of a drop-down menu or radio button menu.
Specify as `['opt1', 'opt2', 'opt3']` or `['value1' => 'label1', 'value2' => 'label2']`.
Special case **ambiguous numerical value/index**: `[0 => 'label1', 1 => 'label2']` or `['0' => 'label1', '1' => 'label2']`: If option values are integers and starting with 0, the label will also be used as value. Use the eval option `isAssociative` to prevent this. | -| [options_callback](../callbacks/#fields-field-options) | Callback function (`array`) | Callback function that returns an array of options. Please specify as `['Class', 'Method']`. | -| foreignKey | table.field (`string`) | Get options from a database table. Returns ID as key and the field you specify as value. The field can be a complete SQL expression, e.g.: `tl_member.CONCAT(firstname,' ',lastname)` | -| reference | `&$GLOBALS['TL_LANG']` (`array`) | Array that holds the options labels. Typically a reference to the global language array. | -| explanation | Array key (`string`) | Array key that holds the explanation. This is a reference to the `XPL` category of the `explain` translation domain. See more information [below](#explanation). | -| [input_field_callback](../callbacks/#fields-field-input-field) | Callback function (`array`) | Executes a custom function instead of using the default input field routine and passes the the DataContainer object and the label as arguments. | -| eval | Field configuration (`array`) | Various configuration options. See next paragraph. | -| [wizard](../callbacks/#fields-field-wizard) | Callback functions (`array`) | Call a custom function and add its return value to the input field. Please specify each callback as `['Class', 'Method']`. | -| sql | Database field definition (`string` or `array`) | Describes data type and its database configuration. (see paragraph [SQL Column Definition](#sql-column-definition)). | -| relation | Configuration of relations (`array`) | Describes relation to parent table (see paragraph [Relations](#relations)). | -| [load_callback](../callbacks/#fields-field-load) | Callback functions (`array`) | These functions will be called when the field is loaded. Please specify each callback function as `['Class', 'Method']`. Passes the field's value and the data container as arguments. Expects the field value as return value. | -| [save_callback](../callbacks/#fields-field-save) | Callback functions (`array`) | These functions will be called when the field is saved. Please specify each callback function as `['Class', 'Method']`. Passes the field's value and the data container as arguments. Expects the field value as return value. Throw an exception to display an error message. | -| [xlabel](../callbacks/#fields-field-xlabel) | Callback functions (`array`) | These functions will be called when the widget is rendered and allows you to add additional html after the field label. Please specify each callback function as `['Class', 'Method']`. +| Key | Value | Description | +|:---------------------|:------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| label | `&$GLOBALS['TL_LANG']` (`array`) | Field label. Typically a reference to the global language array. Needs to be an array containing two elements: the field's label and its description.1 | +| default | Default value (`mixed`) | Default value that is set when a new record is created. | +| exclude | true/false (`bool`) | If true the field will be excluded for non-admins. It can be enabled in the user group module (allowed excluded fields). | +| toggle | true/false (`bool`) | {{< version-tag "4.13" >}} If true the field can be used to trigger the `toggle` action. +| search | true/false (`bool`) | If true the field will be included in the search menu (see "sorting records" -> "panelLayout"). | +| sorting | true/false (`bool`) | If true the field will be included in the sorting menu (see "sorting records" -> "panelLayout"). | +| filter | true/false (`bool`) | If true the field will be included in the filter menu (see "sorting records" -> "panelLayout"). | +| flag | Sorting mode (`integer`) | **1** Sort by initial letter ascending
**2** Sort by initial letter descending
**3** Sort by initial X letters ascending (see length)
**4** Sort by initial X letters descending (see length)
**5** Sort by day ascending
**6** Sort by day descending
**7** Sort by month ascending
**8** Sort by month descending
**9** Sort by year ascending
**10** Sort by year descending
**11** Sort ascending
**12** Sort descending

Note: flags 5 through 10 will also enable formatting of timestamps in the back end when used as a label somewhere. | +| length | Sorting length (`integer`) | Allows to specify the number of characters that are used to build sorting groups (flag **3** and **4**). | +| inputType | Field type (`string`) | [`checkbox`][CheckboxWidget] Checkbox
[`checkboxWizard`][CheckboxWizardWidget] Checkbox Wizard
[`chmod`][ChmodWidget] CHMOD table
[`fileTree`][FileTreeWidget] File tree
`imageSize` Two text fields with drop-down menu (creates an [Image Size Array](/framework/image-processing/image-sizes/#size-array))
`inputUnit` Text field with small unit drop-down menu
`keyValueWizard` Key » Value wizard
[`listWizard`][ListWizardWidget] List wizard
[`metaWizard`][MetaWizardWidget] Used for setting meta information in the file manager
`moduleWizard` Module wizard
`optionWizard` Option wizard
`pageTree` Page tree
`password` Password field
[`picker`][PickerWidget] General purpose picker
`radio` Radio button
`radioTable` Table with images and radio buttons
`sectionWizard` Used for defining sections in the page layout
[`select`][SelectWidget] Drop-down menu
`serpPreview` Search Engine Result Preview (SERP) widget
`tableWizard` Table wizard
`text` Text field
`textStore` Text field that will not display its current value
[`textarea`][TextareaWidget] Textarea
`timePeriod` Text field with drop-down menu
`trbl` Four text fields with a small unit drop-down menu | +| options | Options (`array`) | Options of a drop-down menu or radio button menu.
Specify as `['opt1', 'opt2', 'opt3']` or `['value1' => 'label1', 'value2' => 'label2']`.
Special case **ambiguous numerical value/index**: `[0 => 'label1', 1 => 'label2']` or `['0' => 'label1', '1' => 'label2']`: If option values are integers and starting with 0, the label will also be used as value. Use the eval option `isAssociative` to prevent this. | +| [options_callback](../callbacks/#fields-field-options) | Callback function (`array`) | Callback function that returns an array of options. Please specify as `['Class', 'Method']`. | +| foreignKey | table.field (`string`) | Get options from a database table. Returns ID as key and the field you specify as value. The field can be a complete SQL expression, e.g.: `tl_member.CONCAT(firstname,' ',lastname)` | +| reference | `&$GLOBALS['TL_LANG']` (`array`) | Array that holds the options labels. Typically a reference to the global language array. | +| explanation | Array key (`string`) | Array key that holds the explanation. This is a reference to the `XPL` category of the `explain` translation domain. See more information [below](#explanation). | +| [input_field_callback](../callbacks/#fields-field-input-field) | Callback function (`array`) | Executes a custom function instead of using the default input field routine and passes the the DataContainer object and the label as arguments. | +| eval | Field configuration (`array`) | Various configuration options. See next paragraph. | +| [wizard](../callbacks/#fields-field-wizard) | Callback functions (`array`) | Call a custom function and add its return value to the input field. Please specify each callback as `['Class', 'Method']`. | +| sql | Database field definition (`string` or `array`) | Describes data type and its database configuration. (see paragraph [SQL Column Definition](#sql-column-definition)). | +| relation | Configuration of relations (`array`) | Describes relation to parent table (see paragraph [Relations](#relations)). | +| [load_callback](../callbacks/#fields-field-load) | Callback functions (`array`) | These functions will be called when the field is loaded. Please specify each callback function as `['Class', 'Method']`. Passes the field's value and the data container as arguments. Expects the field value as return value. | +| [save_callback](../callbacks/#fields-field-save) | Callback functions (`array`) | These functions will be called when the field is saved. Please specify each callback function as `['Class', 'Method']`. Passes the field's value and the data container as arguments. Expects the field value as return value. Throw an exception to display an error message. | +| [xlabel](../callbacks/#fields-field-xlabel) | Callback functions (`array`) | These functions will be called when the widget is rendered and allows you to add additional html after the field label. Please specify each callback function as `['Class', 'Method']`. {{% notice tip %}} 1 {{< version-tag "4.9" >}} Defining a label for a DCA field is optional. If @@ -321,6 +321,7 @@ the Doctrine Database Abstraction Layer. [CheckboxWizardWidget]: /reference/widgets/checkbox-wizard/ [FileTreeWidget]: /reference/widgets/file-tree/ [ListWizardWidget]: /reference/widgets/list-wizard/ +[MetaWizardWidget]: /reference/widgets/meta-wizard/ [PickerWidget]: /reference/widgets/picker/ [SelectWidget]: /reference/widgets/select/ [TextareaWidget]: /reference/widgets/textarea/ diff --git a/docs/dev/reference/widgets/meta-wizard.md b/docs/dev/reference/widgets/meta-wizard.md index ed312fee3..abf82210f 100644 --- a/docs/dev/reference/widgets/meta-wizard.md +++ b/docs/dev/reference/widgets/meta-wizard.md @@ -1,6 +1,59 @@ --- title: "Meta Wizard" -description: Not yet documented +description: Allow to edit meta data fields. --- -{{< widget-notice >}} +The meta data widget allows to edit meta data fields. If multiple languages are enabled, the widget will create a row for each language. + +![MetaWizard widget with two languages]({{% asset "images/dev/reference/widgets/meta-wizard.png" %}}?classes=shadow) + +## Options + +| Key | Value | Description | +|--------------------------------------|-------------------------|------------------------------------------------------------------------------------------------------------------------------| +| `inputType` | `metaWizard` (`string`) | | +| `eval.metaFields` | `array` | An array of meta fields to be displayed. The array key is the field. Value can be an string of field attributes or an array. | +| `eval.metaFields.[field].type` | `string` | The field input type. Only supported value is `textarea`, otherwise a text input is shown. | +| `eval.metaFields.[field].attributes` | `string` | The field attributes. | +| `eval.metaFields.[field].dcaPicker` | `bool` | Show a dca picker | +| `eval.metaFields.[field].rgxp` | `string` | A validation regex. | +| `eval.metaFields.[field].rgxpErrMsg` | `string` | Error message if regex validation failed. | + +## Examples + +{{< tabs groupId="meta-wizard-widget-examples" >}} + +{{% tab name="File Manager" %}} + +The Meta Wizard configuration in the file manager. + +```php +// ... +'meta' => [ + 'exclude' => true, + 'inputType' => 'metaWizard', + 'eval' => + [ + 'allowHtml' => true, + 'multiple' => true, + 'metaFields' => [ + 'title' => 'maxlength="255"', + 'alt' => 'maxlength="255"', + 'link' => ['attributes' => 'maxlength="2048"', 'dcaPicker' => true], + 'caption' => ['type' => 'textarea'], + 'license' => [ + 'attributes' => 'maxlength="255"', + 'dcaPicker' => true, + 'rgxp' => '#(^$|^{{link_url::.+$|^https?://.+$)#', + 'rgxpErrMsg' => &$GLOBALS['TL_LANG']['tl_files']['licenseRgxpError'] + ] + ] + ], + 'sql' => "blob NULL" +], +// ... +``` + +{{% /tab %}} + +{{< /tabs >}} \ No newline at end of file diff --git a/page/assets/images/dev/reference/widgets/meta-wizard.png b/page/assets/images/dev/reference/widgets/meta-wizard.png new file mode 100644 index 000000000..2682a5bdf Binary files /dev/null and b/page/assets/images/dev/reference/widgets/meta-wizard.png differ