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

Feature #6111

Simplify expression syntax

Added by Fabien Udriot over 3 years ago. Updated over 2 years ago.

Status:Closed Start date:2010-01-19
Priority:Should have Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Votes: 0

Description

For me, it sounds a bit unnatural to have the following syntax:

{plugin:ecocenter.|categoryId})  // notice the "." after ecocenter

I would prefer to have that

{plugin:ecocenter|categoryId})

The patch is pretty simple:

Index: class.tx_expressions_parser.php
===================================================================
--- class.tx_expressions_parser.php     (revision 28937)
+++ class.tx_expressions_parser.php     (working copy)
@@ -292,7 +306,11 @@
                } else {
                        $indexList = t3lib_div::trimExplode('|', $indices, TRUE);
                        $value = $source;
-                       foreach ($indexList as $key) {
+                       $numberOfElements = count($indexList);
+                       foreach ($indexList as $index => $key) {
+                               if ($index + 1 != $numberOfElements) {
+                                       $key = $key . '.';
+                               }
                                if (is_object($value) && isset($value->$key)) {
                                        $value = $value->$key;
                                } elseif (is_array($value) && isset($value[$key])) {

History

Updated by Fabien Udriot over 3 years ago

  • Status changed from New to Closed

Well... after more thought, it appears my patch is not applicable as Expressions can deal with expressions like

{gp:tx_myextension_pi1|name}

So, I don't see a good solution here as TYPO3 handles associative array in different way.

Updated by Francois Suter over 3 years ago

Indeed, your patch was not correct. There is a t3lib_div method to remove all dots from a TS array, which could be used to "clean up" TSFE->tmpl->setup first, but I'm worried about the impact on performance this could have, as it's a very large array in most cases.

Also available in: Atom PDF