Try our conversational search powered by Generative AI!

LinkItem as property - editing experience is not correct

Vote:
 

I saw online that as of 12.6 I can use LinkItem as a property natively. I have done this:

[ContentType(GroupName = GroupNames.Blocks.BasicComponents, DisplayName = "Text Spotlight", GUID = "3c6d077c-b1c3-4cf6-b993-4fbee19d3c89", Description = "Text spotlight component")]
    [ContentTypeIcon(FontAwesome.Font)]
    public class TextSpotlight : BaseBlockData
    {
        [CultureSpecific]
        [Display(GroupName = TabNames.Content, Name = "Title", Description = "Spotlight title", Order = 100)]
        public virtual string Title { get; set; }

        [Display(GroupName = TabNames.Content, Name = "Title Tag", Description = "HTML tag for the spotlight title", Order = 200)]
        [SelectOneEnum(typeof(HeadingTag))]
        [UIHint("FloatingString")]
        public virtual string TitleTag { get; set; }

        [CultureSpecific]
        [Display(GroupName = TabNames.Content, Name = "Text", Description = "Spotlight text", Order = 300)]
        public virtual XhtmlString Text { get; set; }

        [CultureSpecific]
        [Display(GroupName = TabNames.Content, Name = "CTA", Description = "CTA for the spotlight", Order = 400)]
        public virtual LinkItem Cta { get; set; }

        [Display(GroupName = TabNames.Content, Name = "CTA Style", Description = "CTA Style", Order = 500)]
        [SelectOneEnum(typeof(CtaStyle))]
        [UIHint("FloatingString")]
        public virtual string CtaStyle { get; set; }
    }

And this compiles. But the edtiing experience is not correct. Do I need to something to enable the editing experience?

#281213
Jun 01, 2022 18:16
Vote:
 

Hi Ethan

Which version of the LinkItemProperty do you have in your solution? There was a bug in the old version of LinkItemProperty with CMS 12.6.0. Please upgrade to latest LinkItemProperty 1.0.2. 

Editing broken in Epi 12.6.0 · Issue #6 · episerver/EPiServer.Labs.LinkitemProperty (github.com)

EPiServer.Labs.LinkItemProperty 1.0.2 (optimizely.com)

#281255
Jun 02, 2022 7:03
Vote:
 

Vincent -

There seems to be a problem with the labs link item package. The documentation states that you need to add a tag for the rendering:

@Html.PropertyFor(x => x.CurrentPage.Link, new { Tag = EPiServer.Labs.LinkItemProperty.LinkItemRendering.Tag })

But that LinkItemRendering.Tag does not seem to exist.

Ethan
#281266
Jun 02, 2022 12:04
Vote:
 

@Ethan, your sample code is not the same what is instructed in the documentation. Your property is missing the "[LinkItemProperty]" and "[BackingType(typeof(PropertyLinkCollection))]"

https://github.com/episerver/EPiServer.Labs.LinkitemProperty#using-linkitem-property

#281274
Jun 02, 2022 15:56
Vote:
 

Vincent and Antti - 

I am confused. I was under the impression that LinkItem as a property can now be used natively, without the labs nuget package. If that is tha case, how do I use it? If that is not the case, I cant get the nuget package to work either.

#281276
Jun 02, 2022 16:04
Vote:
 

Hi Ethan

I don't see anywhere mentioned LinkItem has graduated from Lab project, so you have to install the nuget pacakge. I have created a sample project, you can go through the commits to get all details as you need. I hope it helps.

https://github.com/javafun/linkitemdemo/commits/main

#281315
Edited, Jun 03, 2022 7:44
Vote:
 

This is because EPiServer.CMS.Core packages are released in a separate release cycle from EPiServer.CMS.UI packages meaning at some times for features that requires both CMS Core part and CMS UI parts there might be CMS core packages released without a proper UI for the feature. That is the case here, the API functionality is released but the related editor is not yet released (but should be in a recent future). This should replace the need for the Labs project wich will be archived

#281318
Jun 03, 2022 14:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.