Time Period

This widget renders a text field with a drop-down menu and is proposed to be used with time periods.

Time period widget Time period widget

Options

KeyValueDescription
inputType’timePeriod'
optionsarrayThe options for select menu, typically time units like ['s', 'm', 'h']
referencearrayThe translation array (typically &$GLOBALS['TL_LANG']['MSC']['timePeriod'])
eval.disabledbool (default false)Disables the field
eval.maxlengthintMaximum number of characters allowed in the current field.

Additionally, there are inherited global options like: label, default, exclude, search, sorting, filter, flag, sql.

Column Definition

Values are stored as a serialized array, so using blob is preferred.

Example

use Doctrine\DBAL\Platforms\MySQLPlatform;

// …
'time' => [
    'inputType' => 'timePeriod',
    'options' => [
        's', 'm', 'h'
    ],
    'reference' => &$GLOBALS['TL_LANG']['MSC']['timePeriod'],
    'sql' => [
        'type' => 'blob',
        'length' => MySQLPlatform::LENGTH_LIMIT_BLOB,
        'notnull' => false,
    ],
],
// …