[TYPO3-50-general] How can I manipulate Arguments before they are passed to an actionMethod

Robert Lemke robert at typo3.org
Wed Apr 22 17:18:48 CEST 2009


Hi Christoph,

On 22.04.2009, at 10:28, Christoph Blömer wrote:

> I have a URL /webdav/folder1/subfolder2/
> Routing defines: /webdav/{path}
> My argument path would then be: folder1/folder2/
>
> Some revisions ago I could register a newArgument in the
> initializeArguments() metod.

This method doesn't exist anymore (as you figured out).

> And read the value with $this->arguments['path']->getValue() in the
> initializeAction() method.
> Als also tried to register it in the initializeAction but the value is
> empty.

in the initializeAction() or initializeFooAction() methods the arguments
defined in the action method are already available but their values
have not been mapped (on purpose). If that would be the case, the
initializeAction method could not register additional arguments.

> This does not work anymore.

As I see it, it should not be possible for the initialize actions to
tweak the value of the arguments.

> I figured out that I get the path in an actionMethod. For example:
> getAction($path)
> Sometimes my $path is send UTF-8 and urlencoded so I need to decode  
> the
> value. And I would like to do this before it is passed to the  
> ActionMethod.
>
> How and where can I do this?

I propose that you write a filter for that which allows for converting
the charset. Unfortunately filters are not yet applied to action  
arguments,
I'm just about to implement this and created a ticket for it:

http://typo3.org/go/issue/3153

> Furthermore, where can I register additionalArguments which should be
> passed to an actionMethod().

You should, as far as you can, register arguments by declaring them as
part of the action's signature, they can even be optional:

   public function myAction($firstArgument, $secondArgument = '')

If that is not possible, just register them in one of the initialization
methods:

public function initializeMyAction() {
    $this->arguments->addNewArgument('otherArgument');
}

Hope that helps,
robert




More information about the TYPO3-project-5_0-general mailing list