CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

News

Expressions expanded with function calls

Added by Francois Suter over 3 years ago

A new version of extension expressions (1.1.0) was released to the TER today. The main new feature is the addition of functions which can be called on any expression. The syntax is as follows:

key:index1|index2|...->function:var1|var2|...

The functions are keys which are recognized by the expression parser and correspond to existing PHP or TYPO3 functions. Custom functions can be added via a hook. An example might be:

gp:foo->fullQuoteStr:pages

This will retrieve variable "foo" from the GET/POST vars and put it through t3lib_db::fullQuoteStr() with the value of variable "foo" as a first argument and "pages" as the second one. Assuming variable "foo" contained the string "bar", the result will be:

'bar'

New expression key

Fabien introduced the new expression key "plugin". This is a shortcut to $GLOBALS['TSFE']->tmpl->setup['plugin.'] which makes it easy to retrieve a value from the TS configuration of a given plugin.

Other bugfixes

A number of other bugs were fixed, in particular the handling of subexpressions, which was broken. Some features were also missing from the manual.

Testing expressions

In parallel to that, a new extension was created called "expressions_sandbox". It provides a FE plugin to test expressions easily, as it's often not easy to test expressions within the context of an existing extension. The extension will probably not be released to the TER, as it's really useful only to developers, but it can be gotten from Forge: http://forge.typo3.org/projects/show/extension-expressions_sandbox.

Also available in: Atom