[英]How can we add new fields in a new tab in user setting in TYPO3
How can we add new fields in a new tab in user setting in TYPO3 version 8.7? 如何在TYPO3版本8.7的用户设置中的新选项卡中添加新字段? Our problem is the creation of a new tab.
我们的问题是创建一个新选项卡。
I can add new fields to personal data tab in user setting, but I need to create new fields into a new tab. 我可以在用户设置中将新字段添加到个人数据选项卡,但我需要在新选项卡中创建新字段。 For backend admin user setting I added a new tab, but for user setting I want to try this.
对于后端管理员用户设置,我添加了一个新选项卡,但对于用户设置,我想尝试这个。 I have an extension and since the installation of the extension it will add-on.
我有一个扩展,因为安装扩展它将添加。
I tried to create new tab in fe_user.php. 我试图在fe_user.php中创建新标签。
Previously I tried to change ext_tables.php
, but that is not working at all. 以前我试过更改
ext_tables.php
,但这根本不起作用。
// Add some fields to FE Users table to show TCA fields definitions
// USAGE: TCA Reference > $GLOBALS['TCA'] array reference >
// ['columns'][fieldname]['config'] / TYPE: "select"
$temporaryColumns = array (
'tx_examples_options' => array (
'exclude' => 1,
'label' => 'tx_examples_options',
'config' => array (
'type' => 'select',
'showitem' => array (
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.0', '1'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.1', '2'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.2', '--div--'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.3', '3'),
),
'size' => 1,
'maxitems' => 1,
)
),
'tx_examples_special' => array (
'exclude' => 1,
'label' => 'tx_examples_special',
'config' => array (
'type' => 'user',
'size' => '30',
'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField',
'parameters' => array(
'color' => 'blue'
)
)
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'fe_users',
$temporaryColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'fe_users',
'--div--;newtab,tx_examples_options, tx_examples_special'
);
When I changed into file ext_tables.php 当我改成文件ext_tables.php
$GLOBALS['TYPO3_USER_SETTINGS']['columns']['copy_directory'] = array(
'label' => 'Alternative directory for saving copies',
'type' => 'text',
'table' => 'be_users',
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings('copy_directory','after:lang');
then it's showing in "personal data" tab but I want new tab in user setting for non-admin user. 然后它显示在“个人数据”选项卡中,但我想在非管理员用户的用户设置中使用新选项卡。
In general your code looks fine. 通常,您的代码看起来很好。
But you are in the wrong file! 但是你的文件错了!
Avoid ext_tables.php
if possible. 如果可能,请避免使用
ext_tables.php
。
If you change anything to the TCA you should do it in Configuration/TCA/
for new tables and Configuration/TCA/Overrides
for enhancing existing tables. 如果您对TCA进行了任何更改,则应在
Configuration/TCA/
为新表和Configuration/TCA/Overrides
进行更改以增强现有表。
Use filenames according to the table you are modifying. 根据您要修改的表使用文件名。
In your case all the code should be located in Configuration/TCA/Overrides/fe_users.php
. 在您的情况下,所有代码都应位于
Configuration/TCA/Overrides/fe_users.php
。
And be sure you clear all caches if you develop anything with TCA! 如果你用TCA开发任何东西,请务必清除所有缓存!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.