Copied to clipboard

Flag this post as spam?

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

  • Ifrahim Rasool 28 posts 82 karma points
    Nov 28, 2016 @ 20:16
    Ifrahim Rasool

    Hide "Allowed" DocumentType

    Can I hide (not disallow) a node to be created under another node? I have allowed two document types to be created under Home node (content and static).

    When I right click Home node and select Create, it displays both options to create.

    I want to HIDE "static" option because I am creating these nodes programatically and do not want user to create it.

    Is that possible?

  • Dennis Adolfi 1075 posts 6433 karma points MVP 4x c-trib
    Nov 29, 2016 @ 08:16
    Dennis Adolfi

    Hi Ifrahim.

    It appears that the "Allow child node types" is only a UI validation, that determines what a user is allowed to create under another node. It does´nt however add any validation to when you are creating content progamaticlly with the ContentService. So in your case, you could just remove the "Static" doctypes from your "Home" doctypes allowed child nodes, which will make it dissapear from the UI dialog for creating content, but you will still be able to create nodes under home with the doctype Static, using the ContentService.


    As you see, I have a Home doctype and it does NOT allow a doctype called Static. enter image description here

    And I have a doctype called Static, which I´ve just given a name, everything else is default.

    enter image description here

    Now when I right click my Home content node and selects Create, I get this dialog in the UI. Notice there is no doctype called Static.

    enter image description here

    Now, when i run this following code, (i just placed this in a startup event just to try it out, you´d prpbobly want to place it somewhere else), everything works and I dont get any exceptions. (1055 is the ID of my Home page, in the above example called "Overflow")

    var content = ApplicationContext.Current.Services.ContentService.CreateContent("Code generated page", 1055, "static");

    Now after running this code, a new child has appeard under Overflow, with the Static doctype. But a user can still not create any more Static childen, they can only be created programaticlly.

    enter image description here

    I hope this can help you in any way. Best of luck to you!

Please Sign in or register to post replies

Write your reply to: