Copied to clipboard

Flag this post as spam?

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


  • Richard 146 posts 168 karma points
    May 29, 2013 @ 11:09
    Richard
    0

    Who to define DocumentType for UmbracoPropertyType.RelatedLinks

    I have the following Document type property declaration:

            [DocumentTypeProperty(UmbracoPropertyType.RelatedLinks,
    Name = "Quick links", Description = "Footer links to interesting parts of site",
    Tab = DocumentTypes.Tabs.TabNames.Footer)]
    public object QuickLinks { get; set; }

    Do I need to use the Custom Data Types method to get a list of the link items, or is there a built in way of getting the items as a List?

    Thanks

    Richard

  • Stephen 47 posts 270 karma points
    May 29, 2013 @ 11:16
    Stephen
    0

    You'll need to create something that implements ICustomTypeConvertor (as described in that tutorial) to transform the result from Umbraco into whatever data structure you're looking for.

    How you register that depends on which version of uSiteBuilder you're using (recent versions require you to register it on the DocumentTypeProperty attribute like below).

    [DocumentTypeProperty(UmbracoPropertyType.RelatedLinks, CustomTypeConvertor=typeof(YourCustomTypeConvertor),
               
    Name="Quick links",Description="Footer links to interesting parts of site",
               
    Tab=DocumentTypes.Tabs.TabNames.Footer)]

    Stephen

  • Richard 146 posts 168 karma points
    May 30, 2013 @ 10:47
    Richard
    100

    Thanks for that.

    I started to implement this with uSiteBuilder 1.2, and it complained that the converter was already implemented, so I just needed to do:

            [DocumentTypeProperty(UmbracoPropertyType.RelatedLinks,
    Name = "Quick links", Description = "Footer links to interesting parts of site",
    Tab = DocumentTypes.Tabs.TabNames.Footer)]
    public List<Vega.USiteBuilder.Types.RelatedLink> QuickLinks { get; set; }

     

    Cheers

    Richard

     

Please Sign in or register to post replies

Write your reply to:

Draft