[英]Typo3 10 TCA “'type' => 'inline',” create new relation and upload button auto hide
[英]How can I hide create new button in TYPO3 TCA type inline?
如果TCA的字段类型为内联,我想隐藏“创建新”图像按钮。
我的代码如下:
<pre>
'image' => array(
'label' => 'Image',
'config' => array(
'type' => 'inline',
'foreign_table' => 'sys_file_reference',
'foreign_field' => 'uid_foreign',
'foreign_sortby' => 'sorting_foreign',
'foreign_table_field' => 'tablenames',
'foreign_match_fields' => array(
'fieldname' => 'field_slide_image',
),
'foreign_label' => 'uid_local',
'foreign_selector' => 'uid_local',
'foreign_selector_fieldTcaOverride' => array(
'config' => array(
'appearance' => array(
'elementBrowserType' => 'file',
'elementBrowserAllowed' => $allowedFileExtensions
)
)
),
'filter' => array(
array(
'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren',
'parameters' => array(
'allowedFileExtensions' => $allowedFileExtensions,
'disallowedFileExtensions' => $disallowedFileExtensions
)
)
),
'appearance' => array(
'useSortable' => TRUE,
'headerThumbnail' => array(
'field' => 'uid_local',
'width' => '45',
'height' => '45c',
),
'showPossibleLocalizationRecords' => FALSE,
'showRemovedLocalizationRecords' => FALSE,
'showSynchronizationLink' => FALSE,
'showAllLocalizationLink' => FALSE,
'showPossibleRecordsSelector' => "hide",
'enabledControls' => array(
'info' => FALSE,
'new' => false,
'dragdrop' => TRUE,
'sort' => true,
'hide' => TRUE,
'delete' => TRUE,
'localize' => TRUE,
),
),
'behaviour' => array(
'localizationMode' => 'select',
'localizeChildrenAtParentLocalization' => TRUE,
),
),
)
</pre>
我已将此代码添加为“ new” => false,但仍无法正常工作。
找到的解决方案:
我找到了一种解决方案https://forge.typo3.org/issues/71918
我希望这可以为其他用户提供帮助。
使用TYPO3的权限系统仅允许对特定用户组的字段进行读取访问。
使用['appearance'] ['enabledControls'] ['new'] = false在TCA中隐藏“新建”按钮
仅在8.x中有效。
找到的解决方案:
我找到了一种解决方案https://forge.typo3.org/issues/71918
// Render the level links (create new record): if ($config['appearance']['enabledControls']['new']) { > $levelLinks = $this->getLevelInteractionLink('newRecord', $nameObject . '-' . $foreign_table, $config); }
Afaik,只有设置并达到“最大数量”限制后,“新”按钮才会隐藏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.