Bug #70294

Story #46140: Add configurable linkhandler for arbitrary records

additionalGetParameters in PageTS TCEMAIN.preview function does not work with parameter array

Added by Martin R. Krause almost 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Backend API
Target version:
Start date:
2015-10-02
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
easy
Is Regression:
Yes
Sprint Focus:
Stabilization Sprint

Description

The PageTS function TCEMAIN.preview allow preview link configuration for arbitrary tables (which is very cool).

Regarding to web/typo3/sysext/core/Documentation/Changelog/7.2/Feature-66370-AddFlexiblePreviewUrlConfiguration.rst the configuration

additionalGetParameters {
    tx_myext_pi1[special] = HELLO
}

should allow to set extra parameter (e.g. the controller action). This only works for parameter names without subarray (e.g. key=value), multi-dimensional parameters do not work (e.g. tx_ext_aaa[action]=show). The reason is that the TS parser eliminates all keys with "[" or "]“, the resulting TS array is empty.

Writing this parameters wit TS array, like

additionalGetParameters {
    tx_myext_pi1 {
        special = HELLO
   }
}

does not work either, because the key will become "tx_myext_pi1." with a dot.

The feature in question can fe found here: web/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:743

Possible solution: Revers parameter key and values like this:

additionalGetParameters {
    tx_myext_pi1 {
         HALLO = special[subkey]
   }
}

Looks stupid, but the field to parameter mapping configuration in the same feature, that will always be written right above the additionalGetParameters configuration uses the same order. So in practice it would feel natural to the developer.


Related issues

Related to TYPO3 Core - Task #66370: Add generic preview URL generator API Closed 2015-04-10

Associated revisions

Revision 18dd60f9 (diff)
Added by Markus Klein almost 4 years ago

[BUGFIX] additionalParameters for TCEMAIN.preview must handle arrays

Resolves: #70294
Releases: master
Change-Id: Iaa96e5132f473a91e5ed3352cf3f6820a07fa8b3
Reviewed-on: http://review.typo3.org/43911
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Jacob Dreesen almost 4 years ago

I just stumbled about this bug, too.

Martin R. Krause wrote:

Possible solution: Revers parameter key and values like this:

additionalGetParameters {
    tx_myext_pi1 {
         HALLO = special[subkey]
   }
}

Looks stupid, but the field to parameter mapping configuration in the same feature, that will always be written right above the additionalGetParameters configuration uses the same order. So in practice it would feel natural to the developer.

The problem I see with this solution is that parameter names are unique but their values are not necessarily unique, which means you cannot use them as array keys because they would overwrite each other. This works for fieldToParameterMap because field names are unique.

#2 Updated by Georg Ringer almost 4 years ago

  • Status changed from New to Accepted
  • Is Regression changed from No to Yes
  • Sprint Focus set to Stabilization Sprint

#3 Updated by Markus Klein almost 4 years ago

  • Target version set to 7 LTS

#4 Updated by Markus Klein almost 4 years ago

  • Parent task set to #46140

#5 Updated by Markus Klein almost 4 years ago

  • Category set to Backend API
  • Assignee set to Markus Klein
  • Complexity set to easy

#6 Updated by Gerrit Code Review almost 4 years ago

  • Status changed from Accepted 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 http://review.typo3.org/43911

#7 Updated by Gerrit Code Review almost 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43911

#8 Updated by Markus Klein almost 4 years ago

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

#9 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF