Skip to content

Instantly share code, notes, and snippets.

@Plou
Created June 27, 2013 14:08
Show Gist options
  • Save Plou/5876707 to your computer and use it in GitHub Desktop.
Save Plou/5876707 to your computer and use it in GitHub Desktop.
Work in progress... Example of a tca file with text, rich text editor (rte), file (image), date, pages and database entry.
<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');
t3lib_extMgm::allowTableOnStandardPages('tx_indocuments_category');
$TCA['tx_indocuments_category'] = array (
'ctrl' => $TCA['tx_indocuments_category']['ctrl'],
'interface' => array (
'showRecordFieldList' => 'sys_language_uid,l10n_parent,l10n_diffsource,hidden,starttime,endtime,title, parent_category'
),
'feInterface' => $TCA['tx_indocuments_category']['feInterface'],
'columns' => array (
'sys_language_uid' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array (
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
)
)
),
'l10n_parent' => array (
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
'config' => array (
'type' => 'select',
'items' => array (
array('', 0),
),
'foreign_table' => 'tx_indocuments_category',
'foreign_table_where' => 'AND tx_indocuments_category.pid=###CURRENT_PID### AND tx_indocuments_category.sys_language_uid IN (-1,0)',
)
),
'l10n_diffsource' => array (
'config' => array (
'type' => 'passthrough'
)
),
'hidden' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => array (
'type' => 'check',
'default' => '0'
)
),
'starttime' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
'config' => array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'default' => '0',
'checkbox' => '0'
)
),
'endtime' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
'config' => array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'checkbox' => '0',
'default' => '0',
'range' => array (
'upper' => mktime(3, 14, 7, 1, 19, 2038),
'lower' => mktime(0, 0, 0, date('m')-1, date('d'), date('Y'))
)
)
),
'title' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.category.title',
'config' => array (
'type' => 'input',
'size' => '30',
'eval' => 'required',
)
),
'parent_category' => array (
'exclude' => 1,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.category.parent_category',
'config' => Array (
'type' => 'select',
'renderMode' => 'tree',
'treeConfig' => array(
'parentField' => 'parent_category',
'appearance' => array(
'expandAll' => TRUE,
'showHeader' => TRUE,
),
),
'foreign_table' => 'tx_indocuments_category',
'labelField' => 'title',
'autoSizeMax' => 50,
'minitems' => 0,
'maxitems' => 500,
),
),
),
'types' => array (
'0' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, title;;;;2-2-2,parent_category;;;;2-2-2')
),
'palettes' => array (
'1' => array('showitem' => 'starttime, endtime')
)
);
t3lib_extMgm::allowTableOnStandardPages('tx_indocuments_tag');
$TCA['tx_indocuments_tag'] = array (
'ctrl' => $TCA['tx_indocuments_tag']['ctrl'],
'interface' => array (
'showRecordFieldList' => 'sys_language_uid,l10n_parent,l10n_diffsource,hidden,starttime,endtime,title'
),
'feInterface' => $TCA['tx_indocuments_tag']['feInterface'],
'columns' => array (
'sys_language_uid' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array (
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
)
)
),
'l10n_parent' => array (
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
'config' => array (
'type' => 'select',
'items' => array (
array('', 0),
),
'foreign_table' => 'tx_indocuments_tag',
'foreign_table_where' => 'AND tx_indocuments_tag.pid=###CURRENT_PID### AND tx_indocuments_tag.sys_language_uid IN (-1,0)',
)
),
'l10n_diffsource' => array (
'config' => array (
'type' => 'passthrough'
)
),
'hidden' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => array (
'type' => 'check',
'default' => '0'
)
),
'starttime' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
'config' => array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'default' => '0',
'checkbox' => '0'
)
),
'endtime' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
'config' => array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'checkbox' => '0',
'default' => '0',
'range' => array (
'upper' => mktime(3, 14, 7, 1, 19, 2038),
'lower' => mktime(0, 0, 0, date('m')-1, date('d'), date('Y'))
)
)
),
'title' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.tag.title',
'config' => array (
'type' => 'input',
'size' => '30',
'eval' => 'required',
)
),
),
'types' => array (
'0' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, title;;;;2-2-2')
),
'palettes' => array (
'1' => array('showitem' => 'starttime, endtime')
)
);
t3lib_extMgm::allowTableOnStandardPages('tx_indocuments_document');
$TCA['tx_indocuments_document'] = array (
'ctrl' => $TCA['tx_indocuments_document']['ctrl'],
'interface' => array (
'showRecordFieldList' => 'sys_language_uid,l10n_parent,l10n_diffsource,hidden,starttime,endtime,title,file,description,preview,tx_indocuments_category,tx_indocuments_tag,link,source'
),
'feInterface' => $TCA['tx_indocuments_document']['feInterface'],
'columns' => array (
'sys_language_uid' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array (
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
)
)
),
'l10n_parent' => array (
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
'config' => array (
'type' => 'select',
'items' => array (
array('', 0),
),
'foreign_table' => 'tx_indocuments_document',
'foreign_table_where' => 'AND tx_indocuments_document.pid=###CURRENT_PID### AND tx_indocuments_document.sys_language_uid IN (-1,0)',
)
),
'l10n_diffsource' => array (
'config' => array (
'type' => 'passthrough'
)
),
'hidden' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => array (
'type' => 'check',
'default' => '0'
)
),
'starttime' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
'config' => array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'default' => '0',
'checkbox' => '0'
)
),
'endtime' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
'config' => array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'checkbox' => '0',
'default' => '0',
'range' => array (
'upper' => mktime(3, 14, 7, 1, 19, 2038),
'lower' => mktime(0, 0, 0, date('m')-1, date('d'), date('Y'))
)
)
),
'title' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.document.title',
'config' => array (
'type' => 'input',
'size' => '30',
'eval' => 'required',
)
),
'file' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.document.file',
'config' => array (
'type' => 'group',
'internal_type' => 'file',
'allowed' => '',
'disallowed' => 'php,php3',
'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
'uploadfolder' => 'uploads/tx_indocuments',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
)
),
'description' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.document.description',
'config' => array (
'type' => 'text',
'cols' => '30',
'rows' => '5',
'wizards' => array(
'_PADDING' => 2,
'RTE' => array(
'notNewRecords' => 1,
'RTEonly' => 1,
'type' => 'script',
'title' => 'Full screen Rich Text Editing|Formatteret redigering i hele vinduet',
'icon' => 'wizard_rte2.gif',
'script' => 'wizard_rte.php',
),
),
)
),
'preview' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.document.preview',
'config' => array (
'type' => 'group',
'internal_type' => 'file',
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
'uploadfolder' => 'uploads/tx_indocuments',
'show_thumbs' => 1,
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
)
),
'tx_indocuments_category' => array (
'exclude' => 1,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.category.parent_category',
'config' => Array (
'type' => 'select',
'renderMode' => 'tree',
'treeConfig' => array(
'parentField' => 'parent_category',
'appearance' => array(
'expandAll' => TRUE,
'showHeader' => TRUE,
),
),
'foreign_table' => 'tx_indocuments_category',
'labelField' => 'title',
'autoSizeMax' => 50,
'minitems' => 0,
'maxitems' => 500,
),
),
'tx_indocuments_tag' => array (
'exclude' => 1,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.tag',
'config' => Array (
'type' => 'select',
'foreign_table' => 'tx_indocuments_tag',
'maxitems' => '200',
'minitems' => '0',
'form_type' => 'user',
'userFunc' => 'tx_gclib_TCAform_autocomplete->renderAutoCompleteField',
'labelField' => 'title'
),
),
'link' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.document.link',
'config' => array (
'type' => 'input',
'size' => '30',
)
),
'source' => array (
'exclude' => 0,
'label' => 'LLL:EXT:in_documents/locallang_db.xml:tx_indocuments.document.source',
'config' => array (
'type' => 'input',
'size' => '30',
)
),
),
'types' => array (
'0' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, title;;;;2-2-2,file;;;;2-2-2,description;;;richtext[]:rte_transform[mode=ts],preview;;;;2-2-2,tx_indocuments_category;;;;2-2-2,tx_indocuments_tag;;;;2-2-2,link;;;;2-2-2,source')
),
'palettes' => array (
'1' => array('showitem' => 'starttime, endtime')
)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment