That is is also the sample i followed. And it shows the item in the context menu (Right clicking on the page item). But i wanted to add additional items to the create menu (when clicking the three dots on the page item).
The menu rendering event do get triggered when clicking the three dots, but the menu items belongs to the context menu, and this also where my additional menu item shows up.
Hope it makes sense, as i dont have my code nearby at the moment
But I'm not sure you can add items to the Create menu - this list is based on document types and is populated automatically.
You could probably achieve what you want, though, by hooking into the ContentService events. If you use the Saving (or maybe Saved) events and then check the entity is new (ie. just created) and the doc type alias you can then programatically create child nodes of the new page using the ContentService. This would create your sub-pages for you. You might need to have two different document types eg. Contact and ContactWithSubPages and detect the alias and then perform the creation.
Add items to "Create items under ..." Menu
Is it possible to programmatically add custom actions / items to the "Create items under ..." menu?
I have tried adding menuitems in the MenuRendering event, but these seem to end up in the context menu for the node.
What i am trying to achieve is to give the editor the possibility of creating, essentially content templates, but with subpages as well.
Hi Jannich and welcome to our :-)
It is indeed possible to extend the context menu with some custom options.
There is an article on how to do it here http://codepharaoh.co.uk/articles/creating-a-custom-context-menu-item-in-umbraco-7/
Hope this helps!
/Jan
Thanks for your reply.
That is is also the sample i followed. And it shows the item in the context menu (Right clicking on the page item). But i wanted to add additional items to the create menu (when clicking the three dots on the page item).
The menu rendering event do get triggered when clicking the three dots, but the menu items belongs to the context menu, and this also where my additional menu item shows up.
Hope it makes sense, as i dont have my code nearby at the moment
All the documentation for tree events can be found here: https://our.umbraco.com/Documentation/Extending/Section-Trees/trees-v7
But I'm not sure you can add items to the Create menu - this list is based on document types and is populated automatically.
You could probably achieve what you want, though, by hooking into the ContentService events. If you use the Saving (or maybe Saved) events and then check the entity is new (ie. just created) and the doc type alias you can then programatically create child nodes of the new page using the ContentService. This would create your sub-pages for you. You might need to have two different document types eg. Contact and ContactWithSubPages and detect the alias and then perform the creation.
is working on a reply...