Copied to clipboard

Flag this post as spam?

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


  • Delete me 45 posts 66 karma points
    May 13, 2010 @ 16:43
    Delete me
    0

    Disable umbEnsureUniqueName

    Hi all

    I want to disable the "umbEnsureUniqueName" action, but only for nodes under a specific folder/node. 

    I know this action can be disabled in the umbracoSettings.config file, but as said, I want it disabled only for specific subnodes.

    Is this possible in any way?

     

    Thanks,

    /Mathias

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    May 13, 2010 @ 16:51
    Sebastiaan Janssen
    1

    You could disable it everywhere and then implement an eventhandler that would handle the same unique naming function.. Might be best to have a look at the umbraco source code to see how it's done.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    May 14, 2010 @ 23:21
    Aaron Powell
    0

    I'm pretty confident you can't have it turned off for sections of the site without having to modify the code source code.

    Sebastiaan's idea is the best, or you can do the inverse of it (event handler to remove the (#) from the name).

  • Delete me 45 posts 66 karma points
    May 16, 2010 @ 21:57
    Delete me
    0

    Hi Slace

    I like your method best, but how can I catch when umbensureuniquename fires?

    Thanks,

    Mathias

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    May 16, 2010 @ 22:41
    Sebastiaan Janssen
    1

    There's currently no eventhandler for UmbracoEnsureUniqueName, so you'd have to implement an aftersave handler. I'm pretty sure that the Document.AfterSave event will give you the NEW title after the rename, so you could detect (using RegEx) that (#) was added and remove it.

  • Tony 5 posts 25 karma points
    May 27, 2010 @ 13:17
    Tony
    0

    How about this?

    umbEnsureUniqueName is handled by umbraco.ActionHandlers.umbEnsureUniqueName

    You could either adapt this or create your own class that implelements IActionHandler and then make the unique name check if the node is in the protected node tree/folder. If you do create your own then remember to disable the config setting so umbEnsureUniqueName is not called.

    You can set the actions that will be handled by your new handler within the IAction.ReturnActions() method:

            public interfaces.IAction[] ReturnActions()
            {
                interfaces.IAction[] _retVal = {ActionNew.Instance};
                return _retVal;
            }

     

    Clases implementing IActionHandler are loaded at runtime which means
    that there are no other setup when creating a custom actionhandler.

  • Delete me 45 posts 66 karma points
    May 30, 2010 @ 20:27
    Delete me
    0

    Hi Tony

    I like your #1 solution - if I understand correctly, with actionhandlers I can catch when umbEnsureUniqueName fires?

    I'm only a little familiar with event handlers, so can you help me a little how to set up the umbEnsureUniqueName actionhandler?

     

    Thanks!
    Mathias

  • Tony 5 posts 25 karma points
    Jun 01, 2010 @ 12:30
    Tony
    0

    Hi Mathias,

    Depends on what you want to do. Find the umbEnsureUniqueName class file. In there you will find the Execute method which does the main work.

    This is where you would do your checking and amendments if necessary. This action handler will fire depending on what is in the interfaces.IAction array returned by the method ReturnActions(), which you can also edit to include other actions, like unpublish, or save or delete etc.

    Hope that helps,

    Tony

Please Sign in or register to post replies

Write your reply to:

Draft