1
0
2025-03-19 13:47:06 +01:00

150 lines
5.5 KiB
PHP

<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
use Contao\Backend;
use Contao\DataContainer;
use Contao\DC_Table;
use Contao\Input;
/**
* Table tl_arch_projects
*/
$GLOBALS['TL_DCA']['tl_arch_projects'] = array(
'config' => array(
'dataContainer' => DC_Table::class,
'enableVersioning' => true,
'sql' => array(
'keys' => array(
'id' => 'primary'
)
),
),
'list' => array(
'sorting' => array(
'mode' => DataContainer::MODE_SORTABLE,
'fields' => array('title'),
'flag' => DataContainer::SORT_INITIAL_LETTER_ASC,
'panelLayout' => 'filter;sort,search,limit'
),
'label' => array(
'fields' => array('title'),
'format' => '%s',
),
'global_operations' => array(
'all' => array(
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"'
)
),
'operations' => array(
'edit' => array(
'href' => 'act=edit',
'icon' => 'edit.svg'
),
'copy' => array(
'href' => 'act=copy',
'icon' => 'copy.svg'
),
'delete' => array(
'href' => 'act=delete',
'icon' => 'delete.svg',
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"'
),
'show' => array(
'href' => 'act=show',
'icon' => 'show.svg',
'attributes' => 'style="margin-right:3px"'
),
)
),
'palettes' => array(
'__selector__' => array('addSubpalette'),
'default' => '{first_legend},title,selectField,checkboxField,multitextField;{second_legend},addSubpalette'
),
'subpalettes' => array(
'addSubpalette' => 'textareaField',
),
'fields' => array(
'id' => array(
'sql' => "int(10) unsigned NOT NULL auto_increment"
),
'tstamp' => array(
'sql' => "int(10) unsigned NOT NULL default '0'"
),
'title' => array(
'inputType' => 'text',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'flag' => DataContainer::SORT_INITIAL_LETTER_ASC,
'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'selectField' => array(
'inputType' => 'select',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'reference' => &$GLOBALS['TL_LANG']['tl_arch_projects'],
'options' => array('firstoption', 'secondoption'),
//'foreignKey' => 'tl_user.name',
//'options_callback' => array('CLASS', 'METHOD'),
'eval' => array('includeBlankOption' => true, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''",
//'relation' => array('type' => 'hasOne', 'load' => 'lazy')
),
'checkboxField' => array(
'inputType' => 'select',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'reference' => &$GLOBALS['TL_LANG']['tl_arch_projects'],
'options' => array('firstoption', 'secondoption'),
//'foreignKey' => 'tl_user.name',
//'options_callback' => array('CLASS', 'METHOD'),
'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''",
//'relation' => array('type' => 'hasOne', 'load' => 'lazy')
),
'multitextField' => array(
'inputType' => 'text',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'eval' => array('multiple' => true, 'size' => 4, 'decodeEntities' => true, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'addSubpalette' => array(
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('submitOnChange' => true, 'tl_class' => 'w50 clr'),
'sql' => "char(1) NOT NULL default ''"
),
'textareaField' => array(
'inputType' => 'textarea',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'eval' => array('rte' => 'tinyMCE', 'tl_class' => 'clr'),
'sql' => 'text NULL'
)
)
);