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

时间:2017-01-16 09:20:07

标签: typo3 inline backend typo3-tca

我想隐藏"创建新的"对于字段类型的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>

我添加了此代码&#39; new&#39; =&GT;是假的,但它仍无法正常工作。

找到解决方案:

我找到了一个解决方案https://forge.typo3.org/issues/71918

我希望这可以为其他用户提供帮助。

3 个答案:

答案 0 :(得分:1)

使用TYPO3的权限系统仅允许对某个用户组的字段进行读访问。

  

隐藏TCA中的“新建”按钮   ['appearance'] ['enabledControls'] ['new'] = false

仅适用于8.x.

答案 1 :(得分:1)

找到解决方案:

我找到了一个解决方案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);
}

答案 2 :(得分:0)

Afaik,只有设置并达到“maxitems”限制时,“新”按钮才会隐藏。