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.
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.
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:
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.
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
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.
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).
Hi Slace
I like your method best, but how can I catch when umbensureuniquename fires?
Thanks,
Mathias
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.
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.
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
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
is working on a reply...