Weblancet
Simplicity
We designed WebLancet to be as easy as possible to use. More
Scalability
WebLancet is designed to be scalable and extendable beyond the limits of imagination. More
Open source
WebLancet meets demand best as it is driven by community. More
Custom redirect after controller action
Custom redirect after controller action
2008 11 13 01:01:01
Configuring the AfterAction behaviour

WebLancet CMS is designed to easily customize redirect after any specific action.

If you want to set custom AfterAction view (e.g. CreateNew, MoveToTrash, Update) you just need to create two values in Configuration with action name and component type.

We'll use a CreateNew action for example.

AfterCreateNewView  key for ArticleAdministration Component:
%ModelClass/Administration/Default

AfterCreateNewArguments key for ArticleAdministration Component:
ModelId=%d

Note: ComponentType ArticleAdministration is because this action is executed by ArticleAdministrationController

In both parameters these short values are replaced to actual parameters:
    %d - current model id (the one detected and set by action)
    %ModelClass


Special values for AfterCreateNewView -

    None - do not redirect, leave as is
    Default - redirect to default handle


Guidelines for designing proper controller action


When you are writing a new controller action, you should return with that function instance of BaseUrlHandler whitch carries the link to redirect when action is completed sucessfully. Do not return failure url handlers because they will be overrided by Db.

If your function uses some model, please be so kind and set it as the controller's $activeModel during the action. ModelId and ModelClass will be taken from that model. If activeModel is left null after action, %ModelClass and %d will be left as-is.

In general, you should easily customize WebLancet redirect behaviour for every project, keeping the default configuration easy.