DCA - Grundgerüst

DCA - Data Container Array

Das ist ein tl_demo DCA mit den notwendigsten Informationen, welche eine Contao Tabelle benötigt.

$GLOBALS['TL_DCA']['tl_demo'] = array
(
 
    // Config
    'config' => array
    (
        'dataContainer' => 'Table',
        'sql' => array
        (
            'keys' => array
            (
                'id' => 'primary'
            )
        )
    ),
 
    // List
    'list' => array
    (
        'sorting' => array
        (
            'mode' => 0,
            'fields' => array('title')
        ),
 
        'label' => array
        (
            'fields' => array('title'),
            'format' => '%s'
        ),
 
        'global_operations' => array
        (
            'all' => array
            (
                'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
                'href'                => 'act=select',
                'class'               => 'header_edit_all',
                'attributes'          => 'onclick="Backend.getScrollOffset()" accesskey="e"'
            )
        ),
 
        'operations' => array
        (
            'edit' => array
            (
                'label'               => &$GLOBALS['TL_LANG']['tl_news']['edit'],
                'href'                => 'act=edit',
                'icon'                => 'edit.gif'
            ),
 
            'copy' => array
            (
                'label'               => &$GLOBALS['TL_LANG']['tl_news']['copy'],
                'href'                => 'act=copy',
                'icon'                => 'copy.gif'
            ),
 
            'delete' => array
            (
                'label'               => &$GLOBALS['TL_LANG']['tl_news']['delete'],
                'href'                => 'act=delete',
                'icon'                => 'delete.gif',
                'attributes'          => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'
            ),
 
            'show' => array
            (
                'label'               => &$GLOBALS['TL_LANG']['tl_news']['show'],
                'href'                => 'act=show',
                'icon'                => 'show.gif'
            )
 
        )
    ),
 
    // Palettes
    'palettes' => array
    (
        'default' => '{general_legend},title'
    ),
 
    // Fields
    'fields' => array
    (
        'id' => array
        (
            'sql'                     => "int(10) unsigned NOT NULL auto_increment"
        ),
 
        'tstamp' => array
        (
            'sql'                     => "int(10) unsigned NOT NULL default '0'"
        ),
 
        'title' => array
        (
            'label'                   => &$GLOBALS['TL_LANG']['tl_demo']['title'],
            'inputType'               => 'text',
            'eval'                    => array('mandatory'=>true, 'maxlength'=>255),
            'sql'                     => "varchar(255) NOT NULL default ''"
        )
    )
);
Zurück