简体   繁体   English

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

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

I would like to hide "create new" image button in case of TCA for field type is inline. 如果TCA的字段类型为内联,我想隐藏“创建新”图像按钮。

My code is below: 我的代码如下:

<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>

I have added this code 'new' => false, but still it is not working. 我已将此代码添加为“ new” => false,但仍无法正常工作。

Found Solution : 找到的解决方案:

I have found one solution https://forge.typo3.org/issues/71918 我找到了一种解决方案https://forge.typo3.org/issues/71918

I hope this can help for other users. 我希望这可以为其他用户提供帮助。

Use the permission system of TYPO3 to only allow read access to the field for a certain user group. 使用TYPO3的权限系统仅允许对特定用户组的字段进行读取访问。

Hide "New" Button in TCA with ['appearance']['enabledControls']['new'] = false 使用['appearance'] ['enabledControls'] ['new'] = false在TCA中隐藏“新建”按钮

This works in 8.x only. 仅在8.x中有效。

Found Solution : 找到的解决方案:

I have found one solution https://forge.typo3.org/issues/71918 我找到了一种解决方案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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM