Last active
December 10, 2018 15:19
-
-
Save kitzberger/2bd1dfe5a8c2311832c5067773b22a94 to your computer and use it in GitHub Desktop.
TYPO3 TCA example for enriched inline/irre relations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('TYPO3_MODE')) { | |
die('Access denied.'); | |
} | |
$GLOBALS['TCA']['tx_customext_domain_model_department'] = array( | |
'ctrl' => array( | |
'title' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_department', | |
// title prefixed by department_id | |
'label' => 'department_id', | |
'label_alt' => 'title', | |
'label_alt_force' => 1, | |
'default_sortby' => 'ORDER BY title', | |
'tstamp' => 'tstamp', | |
'crdate' => 'crdate', | |
'cruser_id' => 'cruser_id', | |
'dividers2tabs' => true, | |
'versioningWS' => 2, | |
'versioning_followPages' => true, | |
'delete' => 'deleted', | |
'enablecolumns' => array( | |
'disabled' => 'hidden', | |
), | |
'searchFields' => 'title,department_id', | |
'iconfile' => 'EXT:custom_ext/Resources/Public/Icons/department.png', | |
// Copy related settings: | |
'hideAtCopy' => 1, | |
'prependAtCopy' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:prependAtCopy', | |
'setToDefaultOnCopy' => '', | |
), | |
// info dialog for record in BE | |
'interface' => array( | |
'showRecordFieldList' => 'hidden, title', | |
'maxDBListItems' => 5, | |
), | |
'palettes' => array( | |
'1' => array( | |
'canNotCollapse' => '1', | |
'showitem' => 'title, --linebreak--, title_short, --linebreak--, department_id, --linebreak--, employments', | |
), | |
), | |
'types' => array( | |
'1' => array( | |
'showitem' => 'hidden, tx_extbase_type, --palette--;LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_department.department_label;1, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime', | |
), | |
), | |
'columns' => array( | |
't3ver_label' => array( | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'max' => 255, | |
), | |
), | |
'hidden' => array( | |
'exclude' => 1, | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', | |
'config' => array( | |
'type' => 'check', | |
), | |
), | |
'title' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_department.title', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'eval' => 'trim', | |
), | |
), | |
'title_short' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_department.title_short', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'eval' => 'trim', | |
), | |
), | |
'department_id' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_department.department_id', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'eval' => 'trim', | |
), | |
), | |
'employments' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_department.employments', | |
'config' => array( | |
'type' => 'inline', | |
'foreign_table' => 'tx_customext_domain_model_employment', | |
'foreign_field' => 'department', | |
'foreign_label' => 'employee', | |
'appearance' => array( | |
'useSortable' => true, | |
'levelLinksPosition' => 'bottom', | |
), | |
), | |
), | |
), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('TYPO3_MODE')) { | |
die('Access denied.'); | |
} | |
$GLOBALS['TCA']['tx_customext_domain_model_record'] = array( | |
'ctrl' => array( | |
'type' => 'tx_extbase_type', | |
'title' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_record', | |
'label' => 'title', | |
'default_sortby' => 'ORDER BY title ASC', | |
'tstamp' => 'tstamp', | |
'crdate' => 'crdate', | |
'cruser_id' => 'cruser_id', | |
'dividers2tabs' => true, | |
'versioningWS' => 2, | |
'versioning_followPages' => true, | |
'delete' => 'deleted', | |
'enablecolumns' => array( | |
'disabled' => 'hidden', | |
'starttime' => 'starttime', | |
'endtime' => 'endtime', | |
), | |
'searchFields' => 'title', | |
'iconfile' => 'EXT:custom_ext/Resources/Public/Icons/record.png', | |
'typeicon_column' => 'tx_extbase_type', | |
'typeicon_classes' => array( | |
'0' => 'plugin-az-default', | |
'default' => 'plugin-az-default' | |
), | |
// Copy related settings: | |
'hideAtCopy' => 1, | |
'prependAtCopy' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:prependAtCopy', | |
'setToDefaultOnCopy' => '', | |
), | |
// info dialog for record in BE | |
'interface' => array( | |
'showRecordFieldList' => 'hidden, tx_extbase_type, title, characteristics', | |
'maxDBListItems' => 5, | |
), | |
// edit mask for record in BE | |
'types' => array( | |
'0' => array('showitem' => 'hidden, tx_extbase_type, title, description, characteristics, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'), | |
// further types in other extensions | |
), | |
'palettes' => array( | |
// '1' => array('showitem' => ''), | |
// further palettes in other extensions | |
), | |
'columns' => array( | |
'tx_extbase_type' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_record.tx_extbase_type', | |
'config' => array( | |
'type' => 'select', | |
'renderType' => 'selectSingle', | |
'items' => array( | |
array('LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_record.tx_extbase_type.0', '0'), | |
), | |
'size' => 1, | |
'maxitems' => 1, | |
'default' => '0', | |
), | |
), | |
't3ver_label' => array( | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'max' => 255, | |
), | |
), | |
'deleted' => array( | |
'config' => array( | |
'type' => 'passthrough', | |
), | |
), | |
'hidden' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', | |
'config' => array( | |
'type' => 'check', | |
), | |
), | |
'firstname' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_record.employee_firstname', | |
'config' => array( | |
'type' => 'input', | |
'size' => 12, | |
'eval' => 'trim', | |
'readOnly' => 1, | |
), | |
), | |
'lastname' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_record.employee_lastname', | |
'config' => array( | |
'type' => 'input', | |
'size' => 12, | |
'eval' => 'trim', | |
'readOnly' => 1, | |
), | |
), | |
'employments' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_record.employments', | |
'config' => array( | |
'type' => 'inline', | |
'foreign_table' => 'tx_customext_domain_model_employment', | |
'foreign_field' => 'employee', | |
'foreign_label' => 'department', | |
'appearance' => array( | |
'useSortable' => true, | |
'levelLinksPosition' => 'bottom'), | |
), | |
), | |
), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('TYPO3_MODE')) { | |
die('Access denied.'); | |
} | |
$GLOBALS['TCA']['tx_customext_domain_model_employment'] = array( | |
'ctrl' => array( | |
'title' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_employment', | |
'label' => 'department', | |
'label_alt' => 'role', | |
'label_alt_force' => '1', | |
'hideTable' => true, | |
'tstamp' => 'tstamp', | |
'crdate' => 'crdate', | |
'cruser_id' => 'cruser_id', | |
'dividers2tabs' => true, | |
'versioningWS' => 2, | |
'versioning_followPages' => true, | |
'delete' => 'deleted', | |
'enablecolumns' => array( | |
'disabled' => 'hidden', | |
), | |
'searchFields' => '', | |
'iconfile' => 'EXT:custom_ext/Resources/Public/Icons/record.png', | |
// Copy related settings: | |
'hideAtCopy' => 1, | |
'prependAtCopy' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:prependAtCopy', | |
'setToDefaultOnCopy' => '', | |
), | |
'interface' => array( | |
'showRecordFieldList' => 'hidden, employee, department', | |
), | |
'types' => array( | |
'1' => array('showitem' => 'hidden;;1, employee, department'), | |
), | |
'palettes' => array( | |
'1' => array('showitem' => ''), | |
), | |
'columns' => array( | |
't3ver_label' => array( | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'max' => 255, | |
), | |
), | |
'hidden' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', | |
'config' => array( | |
'type' => 'check', | |
), | |
), | |
'employee' => array( | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_employment.employee', | |
'config' => array( | |
'type' => 'select', | |
'renderType' => 'selectSingle', | |
'items' => array( | |
array("", 0), | |
), | |
'foreign_table' => 'tx_customext_domain_model_record', | |
'minitems' => 1, | |
'maxitems' => 1, | |
), | |
), | |
'role' => array( | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_employment.role', | |
'config' => array( | |
'type' => 'select', | |
'renderType' => 'selectSingle', | |
'items' => array( | |
array("", 0), | |
), | |
'foreign_table' => 'tx_customext_domain_model_role', | |
'minitems' => 1, | |
'maxitems' => 1, | |
), | |
), | |
'department' => array( | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_customext_domain_model_employment.department', | |
'config' => array( | |
'type' => 'select', | |
'renderType' => 'selectSingle', | |
'items' => array( | |
array("", 0), | |
), | |
'foreign_table' => 'tx_customext_domain_model_department', | |
'minitems' => 1, | |
'maxitems' => 1, | |
), | |
), | |
), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE tx_customext_domain_model_employment ( | |
uid int(11) NOT NULL auto_increment, | |
pid int(11) DEFAULT '0' NOT NULL, | |
tstamp int(11) unsigned DEFAULT '0' NOT NULL, | |
crdate int(11) unsigned DEFAULT '0' NOT NULL, | |
cruser_id int(11) unsigned DEFAULT '0' NOT NULL, | |
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, | |
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, | |
sorting int(11) unsigned DEFAULT '0' NOT NULL, | |
employee int(11) unsigned DEFAULT NULL, | |
role int(11) unsigned DEFAULT '0' NOT NULL, | |
department int(11) unsigned DEFAULT NULL, | |
t3ver_oid int(11) DEFAULT '0' NOT NULL, | |
t3ver_id int(11) DEFAULT '0' NOT NULL, | |
t3ver_wsid int(11) DEFAULT '0' NOT NULL, | |
t3ver_label varchar(255) DEFAULT '' NOT NULL, | |
t3ver_state tinyint(4) DEFAULT '0' NOT NULL, | |
t3ver_stage int(11) DEFAULT '0' NOT NULL, | |
t3ver_count int(11) DEFAULT '0' NOT NULL, | |
t3ver_tstamp int(11) DEFAULT '0' NOT NULL, | |
t3ver_move_id int(11) DEFAULT '0' NOT NULL, | |
PRIMARY KEY (uid), | |
KEY employee (employee), | |
KEY department (department), | |
KEY deleted (deleted), | |
KEY hidden (hidden), | |
UNIQUE employee_department (employee,department) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('TYPO3_MODE')) { | |
die('Access denied.'); | |
} | |
$GLOBALS['TCA']['tx_customext_domain_model_role'] = array( | |
'ctrl' => array( | |
'title' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_role', | |
'label' => 'title', | |
'default_sortby' => 'ORDER BY title', | |
'tstamp' => 'tstamp', | |
'crdate' => 'crdate', | |
'cruser_id' => 'cruser_id', | |
'dividers2tabs' => true, | |
'versioningWS' => 2, | |
'versioning_followPages' => true, | |
'hideTable' => false, | |
'delete' => 'deleted', | |
'searchFields' => 'title,', | |
'iconfile' => 'EXT:custom_ext/Resources/Public/Icons/employee.png', | |
// Copy related settings: | |
'hideAtCopy' => 1, | |
'prependAtCopy' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:prependAtCopy', | |
'setToDefaultOnCopy' => '', | |
), | |
// info dialog for record in BE | |
'interface' => array( | |
'showRecordFieldList' => 'hidden, title', | |
'maxDBListItems' => 5, | |
), | |
'palettes' => array( | |
'1' => array( | |
'canNotCollapse' => '1', | |
'showitem' => 'title, --linebreak--, role_id', | |
), | |
), | |
'types' => array( | |
'1' => array( | |
'showitem' => 'hidden, tx_extbase_type, --palette--;LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_role.role_label;1, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime', | |
), | |
), | |
'columns' => array( | |
't3ver_label' => array( | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'max' => 255, | |
), | |
), | |
'hidden' => array( | |
'exclude' => 1, | |
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', | |
'config' => array( | |
'type' => 'check', | |
), | |
), | |
'title' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_role.title', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'eval' => 'trim', | |
), | |
), | |
'role_id' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:custom_ext/Resources/Private/Language/locallang_db.xlf:tx_custom_ext_domain_model_role.role_id', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'eval' => 'trim', | |
), | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment