Feature #87551

Explicitly allow ignoring "pidInList" in TS select function

Added by Andreas Wolf over 1 year ago. Updated 7 months ago.

Status:
New
Priority:
Should have
Assignee:
Category:
TypoScript
Start date:
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Currently, the implementation of the TypoScript function "select" will automatically set "pidInList" to "this" if it is not set, even when "uidInList" is specified and points to a uid on a different page.
The result will then be empty, even if the record exists and could be displayed. This is confusing and hard to understand, especially since there is no documented way of ignoring "pidInList". Instead, some people implement workarounds with high recursion limits e.g. descending from the site's root page.

My proposal is to add a new setting "ignore" that will lead to the value not being evaluated. This works already, since the non-empty value will prevent the default of "this" from being used. However, it is undocumented behaviour and thus might break in the future w/o any notice. Therefore, let's make it explicit and document it.

History

#1 Updated by Stefan P 8 months ago

I'd like add a "+1" here.

This is for example totally relevant when using ext:news with inline content element rendering. The news records and their CE sit in some folder but the page used in FE is the detail page. So CTypes using custom inline elements and data processors do not work (they needed to be selected from the news storage pid, but are tried to be selected from the current FE page -> not found).

For anyone reading this: A nasty workaround is this:

// set pid list to your siteroot
pidInList = 1
// set depth to a reasonably high number
recursive = 10

It would be nice if there's a new keyword beside this and root, like ignore or something, which then prevents adding the pid condition in the SQL at all.

#2 Updated by Mathias Brodala 7 months ago

Evidently just setting pidInList = 0 (thus explicitly setting it to 0, zero) in fact leads to the pid part being dropped from the query.

However this will by default lead to a query with uid = 0, so setting uidInList at the same time is mandatory for a valid query.

We should clarify if this is intended behavior since TYPO3 itself makes use of this in AbstractMenuContentObject. If yes, it should be documented properly and tests should be added to verify this behavior and ensure it is not dropped accidentally.

Also available in: Atom PDF