如何在 TYPO3 TCA 类型内联中隐藏创建新按钮?

How can I hide create new button in TYPO3 TCA type inline?

如果 TCA 的字段类型是内联的,我想隐藏 "create new" 图片按钮。

我的代码如下:

<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

希望对其他用户有所帮助。

Afaik,"new" 按钮只有在设置并达到 "maxitems" 限制时才会隐藏。

使用TYPO3的权限系统,只允许特定用户组对该字段进行读取访问。

Hide "New" Button in TCA with ['appearance']['enabledControls']['new'] = false

这仅适用于 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);
}