Issue Bug Closed

#92788Cannot remove the "New" button in EditDocumentController

Xavier Perseguers 11/07/20, 08:16 updated 12/22/20, 11:03

Description

Working on a new feature for EXT:fal_protect, I discover that I cannot remove the “New” button in the toolbar when editing a record.

The “Delete” button can be removed via a userTS option but the “New” cannot.

Result:

new.png

Digging into the code, to understand why the “New” button doesn’t appear when editing the metadata of a file in File > FileList, I found that the EditDocumentController within EXT:backend hardcoded a condition within method registerNewButtonToButtonBar:

        if (
            $this->firstEl['table'] !== 'sys_file_metadata'
            && !empty($this->firstEl['table'])
            && (

When it comes to the “Delete” button, the check is not done directly on table sys_file_metadata but a method getDisableDelete is invoked and although the check on table sys_file_metadata is present as well, it is reading a userTS option options.disableDelete (https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/UserTsconfig/Options.html#disabledelete) to let us change the behaviour.

Problems:

  • System extensions benefit from additional power in regards to user extensions
  • There is no way to at least try to remove that button except by XCLASSing the controller

Suggestion:

  • Introduce a new userTS option options.disableNew back in TYPO3 v9.

Reviews 3