Copied to clipboard

Flag this post as spam?

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


  • andrew shearer 465 posts 580 karma points
    Sep 02, 2021 @ 00:16
    andrew shearer
    0

    ModelsBuilder object not hydrating Multinode treepicker?

    Hi – I have a “footer navigation” property based on Multinode treepicker and have picked some content, but the property is empty when I try to use it on a view.

    Modelsbuilder generates the following as expected:

              ///<summary>
              /// Footer Navigation: Pick items to show on the footer navigation
              ///</summary>
              [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.0.0-rc002+4b7481955abecdd8aefa37d7fb3bfa89e3f46686")]
              [global::System.Diagnostics.CodeAnalysis.MaybeNull]
              [ImplementPropertyType("footerNavigation")]
              public virtual global::System.Collections.Generic.IEnumerable<global::Umbraco.Cms.Core.Models.PublishedContent.IPublishedContent> FooterNavigation => this.Value<global::System.Collections.Generic.IEnumerable<global::Umbraco.Cms.Core.Models.PublishedContent.IPublishedContent>>(_publishedValueFallback, "footerNavigation");
    

    The iPublishedContent seems to have the picked content items: enter image description here

    But the ‘strongly typed’ property in the ModelsBuilder object is null enter image description here

    Any ideas if this issue is unique to my setup? Im on RC2

    thanks

  • Marc Goodson 1677 posts 11072 karma points MVP 6x c-trib
    Sep 04, 2021 @ 10:14
    Marc Goodson
    0

    Hi Andrew

    The modelsbuilder will be using the PropertyValueConverter for the Multinodetreepicker, to take the raw values and turn them into IPublishedContent.

    I can see there was a commit 14 days ago on the dev/v9 branch:

    https://github.com/umbraco/Umbraco-CMS/commit/a8eae13e0e478dda206b7617e10b986afa600056

    that switched a check for whether an UmbracoContext exists...(the boolean was around the wrong way - we've all done it!)

    If I read it correctly, with that logic around the wrong way in rc2, then the attempt to convert to IPublishedContent would never happen... so it looks like it's fixed... for the next release.

    In the meantime, you could probably read the raw values and use Umbraco cache from UmbracoContext.Content to retrieve the IPublishedContent and then cast them to the appropriate ModelsBuilder type if needs be.

    regards

    Marc

  • andrew shearer 465 posts 580 karma points
    Sep 05, 2021 @ 23:39
    andrew shearer
    0

    Ok thanks for confirming Marc. Think i'll just await RC3 :)

Please Sign in or register to post replies

Write your reply to:

Draft