![](/img/trans.png)
[英]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.