49 lines
2.0 KiB
PHP
49 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Contao\CoreBundle\DataContainer\PaletteManipulator;
|
|
|
|
PaletteManipulator::create()
|
|
->addLegend('timed_download_legend', 'store_legend', PaletteManipulator::POSITION_AFTER)
|
|
->addField('timedDownloadEnabled', 'timed_download_legend', PaletteManipulator::POSITION_APPEND)
|
|
->applyToPalette('default', 'tl_form')
|
|
;
|
|
|
|
$GLOBALS['TL_DCA']['tl_form']['palettes']['__selector__'][] = 'timedDownloadEnabled';
|
|
$GLOBALS['TL_DCA']['tl_form']['subpalettes']['timedDownloadEnabled'] = 'timedDownloadFile,timedDownloadDuration,timedDownloadUnit';
|
|
|
|
$GLOBALS['TL_DCA']['tl_form']['fields']['timedDownloadEnabled'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_form']['timedDownloadEnabled'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'eval' => ['submitOnChange' => true, 'tl_class' => 'w50 m12'],
|
|
'sql' => ['type' => 'boolean', 'default' => false],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_form']['fields']['timedDownloadFile'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_form']['timedDownloadFile'],
|
|
'exclude' => true,
|
|
'inputType' => 'fileTree',
|
|
'eval' => ['fieldType' => 'radio', 'files' => true, 'mandatory' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'binary', 'length' => 16, 'notnull' => false],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_form']['fields']['timedDownloadDuration'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_form']['timedDownloadDuration'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['mandatory' => true, 'rgxp' => 'digit', 'maxlength' => 6, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 7],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_form']['fields']['timedDownloadUnit'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_form']['timedDownloadUnit'],
|
|
'exclude' => true,
|
|
'inputType' => 'select',
|
|
'options' => ['hours', 'days', 'weeks', 'months'],
|
|
'reference' => &$GLOBALS['TL_LANG']['tl_form']['timedDownloadUnitOptions'],
|
|
'eval' => ['mandatory' => true, 'chosen' => true, 'tl_class' => 'w50'],
|
|
'sql' => "varchar(16) NOT NULL default 'days'",
|
|
];
|