Copied to clipboard

Flag this post as spam?

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


  • Amna Butt 20 posts 140 karma points
    Jan 28, 2018 @ 10:18
    Amna Butt
    0

    Custom tab on content pages

    I wanted to have my package custom tab on each content page, in which I can add my functionality further. Something like this:

    Custom tab

    There are much examples of how to add section in dashboard etc. Can anyone guide me in this direction. Is Umbraco give support to add custom tab through dynamic code.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 28, 2018 @ 10:44
    Dennis Aaen
    0

    Hi Amna,

    Try to have a look at this video from Umbraco TV

    https://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/tabs-and-properties/

    So you will need to find the document type for the home page in Settings Section --> Document Types. And then follow the video from Umbraco TV

    Hope this helps,

    /Dennis

  • Amna Butt 20 posts 140 karma points
    Jan 28, 2018 @ 10:51
    Amna Butt
    0

    This is a way of adding a tab from Document type section in backoffice.

    I am creating a package and wanted to add tab dynamically when package get installed. I am looking for code to add dynamic tabs in each content page.

    I wanted to achieve same thing you mentioned, but programmatically

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 28, 2018 @ 11:01
    Dennis Aaen
    0

    Hi Amna,

    Okay then you should have look at our services that we have. https://our.umbraco.org/documentation/Reference/Management/Services

    The one that you need to use is the one called ContentTypeService https://our.umbraco.org/documentation/reference/management/services/ContentTypeService

    Hope this helps,

    /Dennis

  • Amna Butt 20 posts 140 karma points
    Jan 28, 2018 @ 13:15
    Amna Butt
    0

    Thank you Dennis, its really helpful. I am able to create tabs pro-grammatically.

    I wanted to ask, If there is any possibility to disable "delete" functionality in my custom tab against added properties.

    Please look into the image for more details:

    Disbale Delete

  • Matthew Wise 271 posts 1373 karma points MVP 4x c-trib
    Jan 28, 2018 @ 14:27
    Matthew Wise
    0

    Hi Amna,

    You can't disable the delete option instead, you can use the events either around the doc type save or on app start

    Matt

  • Amna Butt 20 posts 140 karma points
    Jan 28, 2018 @ 16:32
    Amna Butt
    0

    Hi Matt, How can I achieve it in doc save events?

  • Pawel Bres 39 posts 160 karma points c-trib
    Jan 29, 2018 @ 09:31
    Pawel Bres
    100

    Hi Amna,

    You have to create a document type in your package that includes your Custom Tab and then use ContentTypeService to get all Content types which you want to display this tab and call .AddContentType(IContentTypeComposition contentType) method for each of them.

    you can find more details here Add Content Type Method

  • Amna Butt 20 posts 140 karma points
    Jan 29, 2018 @ 10:10
    Amna Butt
    0

    Hi Pawel, I am able to create tabs in each document type. But when I see the document type in backoffice UI. The delete icon is there against each property of the tab. Its very easy to delete it. So what if user just delete my custom property in my custom tab?

    I want this custom tab without delete option in front-end UI. It will only get delete, when the package get uninstalled.

    My apologizes if I missed any of your point, but now I am looking only for adding custom tab without delete option in UI.

  • Pawel Bres 39 posts 160 karma points c-trib
    Jan 29, 2018 @ 10:45
    Pawel Bres
    0

    Hi Amna,

    you can't disable deleting of the properties but if you use Composition it won't be possible from Content Page view (it will work exactly as on the screenshot you've posted).

    So the 'Custom Tab' will be a part of composited document type, not Content Page document type

  • Amna Butt 20 posts 140 karma points
    Jan 29, 2018 @ 11:37
    Amna Butt
    0

    How to check, if existing document type is composite or not?

    I am using this to get all:

    ApplicationContext.Current.Services.ContentTypeService.GetAllContentTypes();
    

    This is returning all including document type and composite type. Which key will differentiate?

  • Pawel Bres 39 posts 160 karma points c-trib
    Jan 29, 2018 @ 11:48
    Pawel Bres
    0

    I think it's not possible because each document type can be used as a composition in another document type. What you can do is to loop through Content Types and check which ones are used as a composition by .CompositionIds()

Please Sign in or register to post replies

Write your reply to:

Draft