How do I replace the stylesheets tree with my own custom CSS tree
I am working on a package and have written a class that inherits from BaseTree and uses the Data attributes to decorate the class to get it automatically registered as a tree on app startup by umbraco.
I can register this as a new tree perfectly fine, but I would like to replace the CSS tree with my own custom CSS tree class that I have written. Is this possible without modifying the core?
You can alter the trees through the class TreeDefinitionCollection. The code below is executed when the applications starts, and will remove the the "stylesheets" tree. I don't see a way to replace the tree, but you should be able to add your own tree at the same location by giving your tree the same sort value as the deleted tree.
public class ExampleEventHandler : ApplicationEventHandler {
I think it's ok to replace the type in the config file. If it's only for your own project than definetly.
If you would use the custom tree in a package than you have to make sure that an uninstall also reverts to the correct type so that the old css tree will work again.
How do I replace the stylesheets tree with my own custom CSS tree
I am working on a package and have written a class that inherits from BaseTree and uses the Data attributes to decorate the class to get it automatically registered as a tree on app startup by umbraco.
I can register this as a new tree perfectly fine, but I would like to replace the CSS tree with my own custom CSS tree class that I have written. Is this possible without modifying the core?
Thanks, warren
You can alter the trees through the class TreeDefinitionCollection. The code below is executed when the applications starts, and will remove the the "stylesheets" tree. I don't see a way to replace the tree, but you should be able to add your own tree at the same location by giving your tree the same sort value as the deleted tree.
You should be able to replace the existing tree by modifing /config/trees.config
Change the "type" proptery to point to your custom tree, that should replace the existing Stylesheets tree with your new one
You can archieve pretty much the same with either method. However for a package I believe its best not to touch the config files if possible.
I think it's ok to replace the type in the config file. If it's only for your own project than definetly.
If you would use the custom tree in a package than you have to make sure that an uninstall also reverts to the correct type so that the old css tree will work again.
is working on a reply...