Files
survey-bundle/contao/dca/tl_survey_editor.php
T
2026-05-29 10:19:19 +02:00

75 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
use Contao\DC_Table;
use Mummert\SurveyBundle\EventListener\SurveyDcaListener;
$guardCallback = [SurveyDcaListener::class, 'guardEditorSave'];
$GLOBALS['TL_DCA']['tl_survey_editor'] = [
'config' => [
'dataContainer' => DC_Table::class,
'ptable' => 'tl_survey',
'enableVersioning' => true,
'ondelete_callback' => [
[SurveyDcaListener::class, 'guardEditorDelete'],
],
'sql' => [
'keys' => [
'id' => 'primary',
'pid' => 'index',
'survey' => 'index',
'member' => 'index',
],
],
],
'list' => [
'sorting' => [
'mode' => 4,
'fields' => ['member'],
'headerFields' => ['title', 'alias', 'isLocked'],
'panelLayout' => 'sort,search,limit',
],
'label' => [
'fields' => ['member'],
'showColumns' => true,
],
'operations' => [
'edit' => [
'href' => 'act=edit',
'icon' => 'edit.svg',
],
'copy' => [
'href' => 'act=copy',
'icon' => 'copy.svg',
],
'delete' => [
'href' => 'act=delete',
'icon' => 'delete.svg',
'attributes' => 'onclick="if(!confirm(\'Eintrag wirklich löschen?\'))return false;Backend.getScrollOffset()"',
],
'show' => [
'href' => 'act=show',
'icon' => 'show.svg',
],
],
],
'palettes' => [
'default' => '{editor_legend},member',
],
'fields' => [
'id' => ['sql' => 'int(10) unsigned NOT NULL auto_increment'],
'tstamp' => ['sql' => 'int(10) unsigned NOT NULL default 0'],
'pid' => ['sql' => 'int(10) unsigned NOT NULL default 0'],
'survey' => ['sql' => 'int(10) unsigned NOT NULL default 0'],
'member' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_editor']['member'],
'inputType' => 'select',
'options_callback' => [SurveyDcaListener::class, 'getMemberOptions'],
'eval' => ['mandatory' => true, 'includeBlankOption' => true, 'chosen' => true],
'save_callback' => [$guardCallback],
'sql' => 'int(10) unsigned NOT NULL default 0',
],
],
];