Project

General

Profile

Actions

Feature #93789

open

Provide a reliable method to determine page id in the Backend mode

Added by Dmitry Dulepov over 3 years ago. Updated over 1 year ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Backend API
Start date:
2021-03-21
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
medium
Sprint Focus:

Description

Currently there is no public API to get the current page id in the Backend mode. Such API can be useful for hooks that behave differently depending on where they are executed in the page tree. For example, we have a part of the tree where certain operations are restricted additionally to the TYPO3 permissions and we have other parts of the tree where only certain records are allowed, or yet other parts of the tree where we automatically move records to proper places if the editor accidentally creates them in a wrong folder.

Unfortunately the only current solution provided by TYPO3 is a condition that we could use in Page TSConfig but that condition does not work reliably because the implementation there is incomplete. Also we really need to get current page id there, not just whether we are in some part of tree or not. TYPO3 does not provide such public API, so we had to develop our own.

The current TYPO3 code for determining page id is located at EXT:backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php but it is private and does not cover all possible cases.

The idea is to implement a new method in the BackendUtility with the following signature:

/**
 * Determines the current page id while in the Backend context. Behavior
 * in the Frontend context is undefined.
 *
 * @return int Page id or zero if it cannot be determined
 */
public static function getCurrentPageId(): int
{
}
Actions #1

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/+/68525

Actions #2

Updated by Gerrit Code Review over 3 years ago

Patch set 2 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/+/68525

Actions #3

Updated by Gerrit Code Review over 3 years ago

Patch set 3 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/+/68525

Actions #4

Updated by Gerrit Code Review over 3 years ago

Patch set 4 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/+/68525

Actions #5

Updated by Gerrit Code Review over 3 years ago

Patch set 5 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/+/68525

Actions #6

Updated by Gerrit Code Review over 3 years ago

Patch set 6 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/+/68525

Actions #7

Updated by Dmitry Dulepov over 3 years ago

Code is abandoned:

  • Got a comment: "We do not want this"
  • phpstan gives false failures

Not worth spending more time in this case. If anybody needs the code, you can find it there.

Actions #8

Updated by Martin Kutschker over 3 years ago

There was only one commentor that was unhappy with the implementation not the feature.

Actions #9

Updated by Benni Mack over 3 years ago

  • Target version changed from 11.2 to 11.3
Actions #10

Updated by Benni Mack over 3 years ago

  • Target version changed from 11.3 to 11.4
Actions #11

Updated by Benni Mack about 3 years ago

  • Target version changed from 11.4 to 12 LTS
Actions #12

Updated by Benni Mack over 1 year ago

  • Target version changed from 12 LTS to Candidate for Major Version
Actions

Also available in: Atom PDF