Skip to content

Commit

Permalink
[FEATURE] Make record timeable and hidable
Browse files Browse the repository at this point in the history
Resolves: #553
  • Loading branch information
lukaszuznanski committed Nov 16, 2023
1 parent 0557cc0 commit f535765
Showing 1 changed file with 43 additions and 101 deletions.
144 changes: 43 additions & 101 deletions Configuration/TCA/tx_tea_domain_model_product_tea.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,51 @@
'iconfile' => 'EXT:tea/Resources/Public/Icons/Record.svg',
'searchFields' => 'title, description',
'enablecolumns' => [
'fe_group' => 'fe_group',
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'transOrigPointerField' => 'l18n_parent',
'transOrigDiffSourceField' => 'l18n_diffsource',
'languageField' => 'sys_language_uid',
'translationSource' => 'l10n_source',
],
'types' => [
'1' => [
'showitem' =>
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
title, description, image, owner,
--div--;LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.tabs.access,
--palette--;;access,',
],
],
'palettes' => [
'access' => [
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.palettes.access',
'showitem' => 'fe_group',
],
'1' => ['showitem' => 'hidden, starttime, endtime, title, description, image'],
],
'columns' => [
'sys_language_uid' => [
'hidden' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'language',
],
],
'l18n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent',
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.enabled',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
'label' => '',
'value' => 0,
'invertStateDisplay' => true,
],
],
'foreign_table' => 'tx_tea_domain_model_product_tea',
'foreign_table_where' =>
'AND {#tx_tea_domain_model_product_tea}.{#pid}=###CURRENT_PID###
AND {#tx_tea_domain_model_product_tea}.{#sys_language_uid} IN (-1,0)',
'default' => 0,
],
],
'l10n_source' => [
'starttime' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'passthrough',
'type' => 'datetime',
'default' => 0,
],
'l10n_mode' => 'exclude',
'l10n_display' => 'defaultAsReadonly',
],
'l18n_diffsource' => [
'endtime' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'passthrough',
'default' => '',
'type' => 'datetime',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038),
],
],
'l10n_mode' => 'exclude',
'l10n_display' => 'defaultAsReadonly',
],
'title' => [
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.title',
Expand Down Expand Up @@ -107,50 +93,8 @@
'allowed' => 'common-image-types',
],
],
'fe_group' => [
'exclude' => true,
'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.fe_group',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'size' => 7,
'maxitems' => 20,
'items' => [
[
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login',
'value' => -1,
],
[
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login',
'value' => -2,
],
[
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups',
'value' => '--div--',
],
],
'exclusiveKeys' => '-1,-2',
'foreign_table' => 'fe_groups',
],
],
'owner' => [
'exclude' => true,
'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.owner',
'config' => [
'type' => 'group',
'allowed' => 'fe_users',
'default' => 0,
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
'hideSuggest' => true,
],
],
],
];

$typo3Version = new \TYPO3\CMS\Core\Information\Typo3Version();
if ($typo3Version->getMajorVersion() < 12) {
$tca = array_replace_recursive(
Expand All @@ -169,13 +113,6 @@
]
);
unset($tca['columns']['title']['required']);

$tca['columns']['l18n_parent']['config']['items'] = [
[
0 => '',
1 => 0,
],
];
$tca['columns']['image'] = [
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
Expand All @@ -192,19 +129,24 @@
]
),
];
$tca['columns']['fe_group']['config']['items'] = [
[
0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login',
1 => -1,
],
[
0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login',
1 => -2,
],
[
0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups',
1 => '--div--',
$tca['columns']['hidden']['config'] = [
'items' => [
0 => '',
1 => '',
],
'invertStateDisplay' => true,
];
$tca['columns']['starttime']['config'] = [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime,int',
'default' => 0,
];
$tca['columns']['endtime']['config'] = [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime,int',
'default' => 0,
];
}

Expand Down

0 comments on commit f535765

Please sign in to comment.