contao/issues — Issue #16: Custom BE Ajax actions
Author: importer
Created: 2011-11-23 18:50:41+00:00
State: open
Labels: backend, Feature

Hi Leo,

I'm developping a set of new modules which one required the definition of a new field form similar to pagetree.
The problem is that to use it to create a module, I need to display it like a pagetree and use Ajax to allow deployment of values to select.

But I see that your class Ajax is not extendable to new actions in both

```
executePreActions
```

and

```
executePostActions
```

methods.

I think I've searched every solutions possible but none has worked so I come with this solution :
In the previous methods on each switch case, I add a default case who implement a custom action and getter and setter.
See the code of my Ajax.php in the attached file.

Like you can see, I didn't modify anything in your class, I've simply added new generics fonctionnalities.
Now, I want to know what you think of integrate this evolution on Typolight and, why not, some ideas to improve my solution.

To go further, why not make the class Ajax, a library class who get an singleton class Action in the library too => like this we can register all actions we want without risk to disable a friend action in another module and more it can be used on both front end and back end modules.

[Download the attachments](http://www.contao.org/tl_files/tickets/16.zip "Download the attachments of this ticket")

--- _Originally created by Chriscool on August 29th, 2008, at 03:38pm (ID 16)_