Copied to clipboard

Flag this post as spam?

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


  • Barry Fogarty 493 posts 1129 karma points
    May 24, 2016 @ 14:22
    Barry Fogarty
    0

    Feature request: Detect when MNTP has only a single item

    First of all thanks for your work on this essential package. Most of this stuff should be in the core but anyway. One little pet peeve I have is resolving MNTP properties that only have a single item selected. I reckon this is quite a common situation as the MNTP is so much more flexible as a picker than the default.

    It would be fantastic if, in this case we could simply do

    content.GetPropertyValue<IPublishedContent>("alias")
    

    rather than

    content.GetPropertyValue<IEnumerable<IPublishedContent>>("alias").FirstOrDefault();
    

    what do you think? I can try a PR if there are no complications that you can foresee.

    Thanks again, keep up the awesome work!

  • Jeavon Leopold 3042 posts 13382 karma points MVP 8x admin c-trib
    May 24, 2016 @ 15:26
    Jeavon Leopold
    0

    Hey Barry,

    Great idea! To check, if the maximum number of items in the data type prevalue is set to 1, then it becomes a single item instead of a collection?

    I have the function in the media picker already except that it has a checkbox "allow multiple", it would be pretty similar for the multinode tree picker.

    Jeavon

  • Barry Fogarty 493 posts 1129 karma points
    May 24, 2016 @ 16:25
    Barry Fogarty
    0

    Yes, exactly that. Fantastic! Let me know what the update drops and I will test in my project.

Please Sign in or register to post replies

Write your reply to:

Draft