PHP-Code:
$GLOBALS['TL_DCA']['tl_finproduct'] = [
'config' => [
'dataContainer' => DC_Table::class,
'enableVersioning' => true,
'switchToEdit' => true,
'sql' => [
'keys' => [
'id' => 'primary'
]
]
],
'list' => [
'sorting' => [
'mode' => 1,
'fields' => ['name'],
'flag' => 1,
'panelLayout' => 'search,limit'
],
'label' => [
'fields' => ['name'],
'format' => '%s'
],
'operations' => [
'editheader' => [
'href' => 'act=edit',
'icon' => 'header.svg'
],
'delete' => [
'href' => 'act=delete',
'icon' => 'delete.svg'
],
'show' => [
'href' => 'act=show',
'icon' => 'show.svg'
]
]
],
'fields' => [
'id' => [
'sql' => ['type' => 'integer', 'unsigned' => true, 'autoincrement' => true],
],
'tstamp' => [
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0]
],
'name' => [
'search' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'mandatory' => true],
'sql' => ['type' => 'string', 'length' => 255, 'default' => '']
],
'description' => [
'search' => true,
'inputType' => 'textarea',
'eval' => ['mandatory' => true, 'allowHtml' => true, 'rte' => 'tinyMCE'],
'sql' => 'text'
],
'risk_level' => [
'search' => false,
'inputType' => 'select',
'eval' => ['mandatory' => true, 'tl_class' => 'w50'],
'reference' => &$GLOBALS['TL_LANG']['tl_finproduct']['risk_level']['values'],
'options' => [
1 => 'very_low',
2 => 'low',
3 => 'middle',
4 => 'high',
5 => 'very_high'
],
'sql' => ['type' => 'string', 'length' => 100, 'default' => 1]
],
'profit_level' => [
'search' => false,
'inputType' => 'select',
'eval' => ['mandatory' => true, 'tl_class' => 'w50'],
'reference' => &$GLOBALS['TL_LANG']['tl_finproduct']['profit_level']['values'],
'options' => [
1 => 'very_low',
2 => 'low',
3 => 'middle',
4 => 'high',
5 => 'very_high'
],
'sql' => ['type' => 'string', 'length' => 100, 'default' => 1]
]
],
'palettes' => [
'default' => '{finproduct_legend},name,description,risk_level,profit_level'
],
];
Die Übersetzungsdatei:
PHP-Code:
$GLOBALS['TL_LANG']['tl_finproduct']['new'] = ['Create new product', 'Creates a new product'];
$GLOBALS['TL_LANG']['tl_finproduct']['edit'] = ['Edit product ID %s', 'Edit product ID %s'];
$GLOBALS['TL_LANG']['tl_finproduct']['finproduct_legend'] = 'Financial Product';
$GLOBALS['TL_LANG']['tl_finproduct']['name'] = ['Name', 'Name of the financial product'];
$GLOBALS['TL_LANG']['tl_finproduct']['description'] = ['Description', 'Description of the financial product'];
$GLOBALS['TL_LANG']['tl_finproduct']['risk_level']['values']['very_low'] = 'Very low';
$GLOBALS['TL_LANG']['tl_finproduct']['risk_level']['values']['low'] = 'Low';
$GLOBALS['TL_LANG']['tl_finproduct']['risk_level']['values']['middle'] = 'Middle';
$GLOBALS['TL_LANG']['tl_finproduct']['risk_level']['values']['high'] = 'High';
$GLOBALS['TL_LANG']['tl_finproduct']['risk_level']['values']['very_high'] = 'Very High';
$GLOBALS['TL_LANG']['tl_finproduct']['risk_level'] = ['Risk Level', 'Risk level of the financial product'];
$GLOBALS['TL_LANG']['tl_finproduct']['profit_level']['values']['very_low'] = 'Very low';
$GLOBALS['TL_LANG']['tl_finproduct']['profit_level']['values']['low'] = 'Low';
$GLOBALS['TL_LANG']['tl_finproduct']['profit_level']['values']['middle'] = 'Middle';
$GLOBALS['TL_LANG']['tl_finproduct']['profit_level']['values']['high'] = 'High';
$GLOBALS['TL_LANG']['tl_finproduct']['profit_level']['values']['very_high'] = 'Very High';
$GLOBALS['TL_LANG']['tl_finproduct']['profit_level'] = ['Profit Level', 'Profit level of the financial product'];
Und der DEBUG Output via contao-console von einem der beiden Felder: