Bug #92788
closedCannot remove the "New" button in EditDocumentController
100%
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:
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.
Files
Updated by Simon Gilli about 4 years ago
- Related to Feature #87321: Edit Record: New Button cannot be disabled for Editors added
Updated by Xavier Perseguers about 4 years ago
Since I was quite sure I already had this problem, I searched a bit and found that indeed in another project I already XCLASSed this controller exactly for that purpose, I wanted to have something similar to the hardcoded check on sys_file_metadata
but available to any extension by having a way to signal that some tables may (sometimes) allow or disallow access to the new and delete button based on any business logic and not solely on userTS which could possibly be overridden.
Updated by Gerrit Code Review about 4 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66559
Updated by Gerrit Code Review about 4 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66578
Updated by Gerrit Code Review about 4 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66579
Updated by Xavier Perseguers about 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 7877f53abf7b5814ec4667cb977cb6c943812e64.