Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Floffy 26 posts 33 karma points
    May 24, 2009 @ 19:09
    Floffy
    0

    Actionhandler to catch more than one action?

    Hi,
    I'm trying to create an actionhandler that catches more actions (create, save, publish)

    I made a property to show "debuginfo" during development. It looks like only the create event fires.
    Any ideas?

    Part of the code - just as a proof of concept:
    [code]using umbraco.BusinessLogic.Actions;
    using umbraco.BusinessLogic.console;
    using umbraco.cms.businesslogic.web;
    ...
    public umbraco.interfaces.IAction[] ReturnActions()
    {
    return new umbraco.interfaces.IAction[] {
    new umbraco.BusinessLogic.Actions.ActionNew(),
    new umbraco.BusinessLogic.Actions.ActionSave(),
    new umbraco.BusinessLogic.Actions.ActionPublish()};
    }
    ...
    public bool Execute(Document documentObject, umbraco.interfaces.IAction action)
    {
    string myAction = action.Alias;
    documentObject.getProperty("debuginfo").Value += myAction+" -";
    return true;
    }
    [/code]

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    May 24, 2009 @ 19:52
    Richard Soeteman
    0

    Hi,

    If you are using V4 of Umbraco it's good to know that action handlers are depricated. Events are the prefered way for V4. This document tells you how to create a class that can subscribe to eventsIt's possible to subscribe to more than 1 event so that should work for you. I have written a pdf with of all the umbraco 4.0.1 events. I've also written a blogpost with a few examples.

    Hope this helps you,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft