Bug #38631

Feature #38629: Make TypoScript usable outside the context of TYPO3 / Nodes, but also for building extensible FLOW3 applications

Make use of FlowQuery explicit by introducing a wrapper function "q" (for "query")

Added by Sebastian Kurfuerst about 3 years ago. Updated almost 3 years ago.

Status:Resolved Start date:2012-07-04
Priority:Should have Due date:
Assigned To:- % Done:

100%

Category:-
Target version:-

Description

While FlowQuery expressions such as ${context.children('foo > bar[title^=Hi]')} are very concise and have a high expressional power when it comes to TYPO3 Phoenix and TYPO3CR Nodes, it becomes cumbersome to work with objects this way. For objects, normally, you only want to traverse the objects by calling getters and setters, or call some functions on them.

So, I propose a breaking change: FlowQuery should be used explicitely, i.e. by introducing a function q similar to the jQuery function. Thus, the above text should be written as: ${q(context).children('foo > bar[title^=Hi]')}


Related issues

blocks Foo.ContentManagement - Major Feature #37293: Refactor Admin to work inside Phoenix as Foo.ContentManag... New 2012-05-18

Associated revisions

Revision ba74758a
Added by Sebastian Kurfuerst almost 3 years ago

[!!!][FEATURE] Make TypoScript Context multi-valued; make FlowQuery use explicit

Before, the TypoScript context only contained a single value which was
available in the template as "context". Inside TypoScript Eel expressions, we
automatically wrapped the context object with FlowQuery; so "context" inside
eel expressions was a wrapped context.

Now, we're untangling this:

  • The TypoScript context can contain multiple named values, which are all
    directly available inside Eel expressions. So, if your context contains a
    variable "node", this is directly accessible inside Eel.
  • FlowQuery must be explicitly used, by calling the "q" function (short for
    "Query").
  • The hardcoded "context" variable inside Fluid templates has been removed; so
    all variables which should be available inside Fluid must be explicitly
    passed into the template.

In the context of Phoenix, before this change, one used f.e.
"context.property('title')". Now, he has to use "q(node).property('title')".

Backwards Compatibility =======================

Together with If043a53cb0556ca1d8e72ae05e269dcb8ee056f5, we are inserting a
backwards compatibility layer:

  • "context" inside Eel expression is the same as "q(node)", so this is the same
    behavior as before
  • "context" inside Fluid Templates is a reference to "node", as it was before.

Still, you should rewrite your templates as we will remove this compatibility
layer later on.

Note: We're merging two features as one change, as it is required in order to
provide backwards compatible behavior.

Resolves: #38631
Resolves: #38633
Change-Id: I5b1863510d372d953c7a076c03214295d4f1131b

History

#1 Updated by Gerrit Code Review about 3 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#2 Updated by Sebastian Kurfuerst about 3 years ago

  • Status changed from New to Accepted
  • % Done changed from 0 to 30

#3 Updated by Christopher Hlubek about 3 years ago

I can understand the reason behind that change, but I fear that TypoScript + Eel + FlowQuery is already quite complex. If we change anything, we should try to keep it simple for TypoScript developers in 90% of the use cases. If you want to access the raw result you can write xyz.get() (if it is a FlowQuery) or maybe we introduce a function to do that safely for any expression. But this is not necessarily be a feature for the average TypoScript developer.

#4 Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#5 Updated by Gerrit Code Review almost 3 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#6 Updated by Gerrit Code Review almost 3 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#7 Updated by Gerrit Code Review almost 3 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#8 Updated by Sebastian Kurfuerst almost 3 years ago

  • Status changed from Accepted to Under Review

#9 Updated by Gerrit Code Review almost 3 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#10 Updated by Gerrit Code Review almost 3 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#11 Updated by Gerrit Code Review almost 3 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#12 Updated by Gerrit Code Review almost 3 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12649

#13 Updated by Sebastian Kurfuerst almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 30 to 100

Also available in: Atom PDF