如何在我的 typo3 自定义分机上启用隐藏按钮?
How to enable hide button on my typo3 custom ext?
我做了一个允许你创建自定义记录(想法)的扩展,但是这个想法应该默认在 1 中有“hidder”字段,这样后端用户可以在前台显示它之前批准它 -结尾。
我有,“hider”列在那里,我的模型有一个 hide 属性 我可以在 1 中设置并且记录没有在前端正确显示但我不知道如何显示后端的“隐藏记录”按钮。
我需要显示与类别相同的隐藏按钮,但在我的自定义记录“想法”中。
我对typo3了解不多,所以我不知道这是在哪里配置的。这是我的 tx 文件。
<?php
return [
'ctrl' => [
'title' => 'LLL:EXT:my_custom_ext/Resources/Private/Language/locallang_db.xlf:hk_ideas_idea',
'label' => 'title',
'iconfile' => 'EXT:my_custom_ext/Resources/Public/Icons/Extension.svg',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
],
'columns' => [ ...(noting about hide field here)... ],
'types' => [
'0' => ['showitem' => 'title, description, category, status, user, voted_users'],
],
];
这是我的 tt_content 文件
<?php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Vendor.Extension',
'Ideas',
'The Ideas Data Record List',
'EXT:my_custom_ext/Resources/Public/Icons/Extension.svg'
);
将启用字段添加到您的 showitem
'types' => [
'0' => ['showitem' => 'title, description, category, status, user, voted_users, hidden, starttime, endtime'],
],
在columns
部分也将有这些配置:
'hidden' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
0 => '',
1 => '',
'invertStateDisplay' => true
]
],
],
],
'starttime' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime,int',
'default' => 0,
'behaviour' => [
'allowLanguageSynchronization' => true
]
],
],
'endtime' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
],
'behaviour' => [
'allowLanguageSynchronization' => true
]
],
],
除了采纳的答案,对学习TCA可能会有帮助:
- TCA 被缓存,因此在进行更改时需要刷新缓存(或将开发系统配置为不缓存这些文件)
- 查看后端的现有配置(在 Configuration => $GLOBALS['TCA'])
- 虽然看起来令人生畏,但 TCA 参考实际上是最新的并且状态良好:https://docs.typo3.org/m/typo3/reference-tca/master/en-us/(阅读时切换到您的版本)
- 不幸的是,除了 https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/ExtendingTca/Examples/Index.html
之外,没有真正好的初学者教程
- “样式指南”扩展是一个用作 TYPO3 后端样式指南的扩展。它包括许多您可以查看的 TCA 配置示例和解释性文本。此外,TCA 参考中的示例通常取自风格指南。重要:确保生成示例记录。参见 How to install and use the "styleguide"。
我做了一个允许你创建自定义记录(想法)的扩展,但是这个想法应该默认在 1 中有“hidder”字段,这样后端用户可以在前台显示它之前批准它 -结尾。
我有,“hider”列在那里,我的模型有一个 hide 属性 我可以在 1 中设置并且记录没有在前端正确显示但我不知道如何显示后端的“隐藏记录”按钮。
我需要显示与类别相同的隐藏按钮,但在我的自定义记录“想法”中。
我对typo3了解不多,所以我不知道这是在哪里配置的。这是我的 tx 文件。
<?php
return [
'ctrl' => [
'title' => 'LLL:EXT:my_custom_ext/Resources/Private/Language/locallang_db.xlf:hk_ideas_idea',
'label' => 'title',
'iconfile' => 'EXT:my_custom_ext/Resources/Public/Icons/Extension.svg',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
],
'columns' => [ ...(noting about hide field here)... ],
'types' => [
'0' => ['showitem' => 'title, description, category, status, user, voted_users'],
],
];
这是我的 tt_content 文件
<?php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Vendor.Extension',
'Ideas',
'The Ideas Data Record List',
'EXT:my_custom_ext/Resources/Public/Icons/Extension.svg'
);
将启用字段添加到您的 showitem
'types' => [
'0' => ['showitem' => 'title, description, category, status, user, voted_users, hidden, starttime, endtime'],
],
在columns
部分也将有这些配置:
'hidden' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
0 => '',
1 => '',
'invertStateDisplay' => true
]
],
],
],
'starttime' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime,int',
'default' => 0,
'behaviour' => [
'allowLanguageSynchronization' => true
]
],
],
'endtime' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
],
'behaviour' => [
'allowLanguageSynchronization' => true
]
],
],
除了采纳的答案,对学习TCA可能会有帮助:
- TCA 被缓存,因此在进行更改时需要刷新缓存(或将开发系统配置为不缓存这些文件)
- 查看后端的现有配置(在 Configuration => $GLOBALS['TCA'])
- 虽然看起来令人生畏,但 TCA 参考实际上是最新的并且状态良好:https://docs.typo3.org/m/typo3/reference-tca/master/en-us/(阅读时切换到您的版本)
- 不幸的是,除了 https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/ExtendingTca/Examples/Index.html 之外,没有真正好的初学者教程
- “样式指南”扩展是一个用作 TYPO3 后端样式指南的扩展。它包括许多您可以查看的 TCA 配置示例和解释性文本。此外,TCA 参考中的示例通常取自风格指南。重要:确保生成示例记录。参见 How to install and use the "styleguide"。