Project

General

Profile

Actions

Bug #92788

closed

Cannot remove the "New" button in EditDocumentController

Added by Xavier Perseguers over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-11-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

new.png (28 KB) new.png Xavier Perseguers, 2020-11-07 08:10

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #87321: Edit Record: New Button cannot be disabled for EditorsClosed2019-01-03

Actions
Actions #1

Updated by Simon Gilli over 3 years ago

  • Related to Feature #87321: Edit Record: New Button cannot be disabled for Editors added
Actions #2

Updated by Xavier Perseguers over 3 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.

Actions #3

Updated by Gerrit Code Review over 3 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

Actions #4

Updated by Gerrit Code Review over 3 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

Actions #5

Updated by Gerrit Code Review over 3 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

Actions #6

Updated by Xavier Perseguers over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF