Copied to clipboard

Flag this post as spam?

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


  • Rihab 104 posts 388 karma points
    Feb 05, 2019 @ 10:18
    Rihab
    0

    Create a property editor that displays some current page property values

    Hi,

    I'm trying to create a custom property editor that shows images from the current page... is there a way to do that ???

    can someone help me.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 05, 2019 @ 11:55
    Alex Skrypnyk
    2

    Hi

    Yes, it's super easy

    What property editor do you use for image-picking?

    Alex

  • Rihab 104 posts 388 karma points
    Feb 05, 2019 @ 12:03
    Rihab
    0

    Media Picker.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 05, 2019 @ 12:28
    Alex Skrypnyk
    0

    Code example:

    @{
        var typedMediaPickerSingle = Model.Content.GetPropertyValue<IPublishedContent>("featuredBanner");
        if (typedMediaPickerSingle != null)
        {
            <p>@typedMediaPickerSingle.Url</p>
            <img src="@typedMediaPickerSingle.Url" style="width:200px" alt="@typedMediaPickerSingle.GetPropertyValue("alt")" />
        }
    }
    

    Read more about Media picker in docs - https://our.umbraco.com/documentation/getting-started/backoffice/property-editors/Built-in-Property-Editors/Media-Picker2

  • Rihab 104 posts 388 karma points
    Feb 05, 2019 @ 13:32
    Rihab
    0

    Hi Alex, Thank you for your help, sorry, I think my question wasn't clear... I'm creating a custom property type editor called 'VR' and I want this custom property type to show an image form the same content page in the backoffice .

    thanks again. Rihab

  • Frans de Jong 548 posts 1840 karma points MVP 3x c-trib
    Feb 05, 2019 @ 12:32
    Frans de Jong
    0

    Are you trying to create a property type that shows all the images on the page in the backoffice? Or do you want to show the images picked in the mediapicker in a view?

    The second option is answered by Alex but if I read your question I think you mean option one?

  • Rihab 104 posts 388 karma points
    Feb 05, 2019 @ 13:34
    Rihab
    0

    yes Frans you are right, I think my question wasn't clear... I'm creating a custom property type editor called 'VR' and I want this custom property type to show an image form the same content page in the backoffice.

    Thanks. Rihab.

  • Rihab 104 posts 388 karma points
    Feb 06, 2019 @ 08:45
    Rihab
    0

    any idea guys?

  • Frans de Jong 548 posts 1840 karma points MVP 3x c-trib
    Feb 06, 2019 @ 10:42
    Frans de Jong
    1

    I would start with this guide:

    https://our.umbraco.com/Documentation/Tutorials/Creating-a-Property-Editor/

    You could tailor the assetservice to get the image you want to show.

    There is no out of the box solution I'm afraid...

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 07, 2019 @ 14:38
    Dirk De Grave
    1

    Hi,

    Properties of the same page are completely isolated, one should not know about another one... whilst it would be possible to fetch data from another property, it's just not how it should work.

    Can't you create a custom property editor that has both image and whatever other info you want manage (together) as a single property?

  • Rihab 104 posts 388 karma points
    Feb 10, 2019 @ 08:13
    Rihab
    0

    that's actually a good idea...... i'll try it.

    Thanks Dirk.

Please Sign in or register to post replies

Write your reply to:

Draft