简体   繁体   中英

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.

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.

Found Solution :

I have found one solution 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.

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

This works in 8.x only.

Found Solution :

I have found one solution 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,只有设置并达到“最大数量”限制后,“新”按钮才会隐藏。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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