[TYPO3-dev] RealUrl #13475: userFunc an Bypass or: Add possibility to userFuncs to bypass the param as known from valueMap
Steffen Ritter
info at rs-websystems.de
Tue Feb 9 11:31:10 CET 2010
Hi Dmitry,
I'm just trying to use your glorius realurl again :)
Situation:
Currently I'm trying to use a userFunc on a preVar.
This works, if the preVar is set, with an UserFunction "bypassing" the
preVar is not possible.
The result is, that if no pre-var is set the first segment of the
page-path is not recognized as page-path.
so domain: domain.com/page1(.html) domain.com/page2.html ... will always
decoded as domain.com/
Analyses:
I digged into realurl code and worked on a solution which does not harm
any existing configuration, fully backwarts-compatible but allows the
userfunc to "bypass" the value itself if no match is found.
"Bypassing" the value is done in line 1339 with the call of
array_unshift($pathParts, $origValue);
This "Bypassing" is logically located before the userFunc so does not
work if the userfunc returns the empty/plain value.
On line 1344 in class.tx_realurl.php you build the param array as following:
$params = array('pObj' => &$this, 'value' => $value, 'decodeAlias' => TRUE);
Solution:
change line 1344 to:
$params = array('pObj' => &$this, 'value' => $value, 'decodeAlias' =>
TRUE, 'pathParts' => &$pathParts, 'origValue' => $origValue);
With this, the userFunc additionally has the possibility to manipulate
the $pathParts array.
So, if the Userfunc "finds out" that there is no matching - and
therefore it seems that there is no pre-var applied it can call the
array_unshift($params['pathParts'],$params['origValue']); itself.
Since this does not change any default behavoiur but just adds a new
possibility it would be nice if you could adapt the solution.
I just created a feature request in the bugtracker about it.
Would be nice to hear your opinion regarding the topic.
regards
Steffen
More information about the TYPO3-dev
mailing list