Copied to clipboard

Flag this post as spam?

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


  • ٌ 42 posts 202 karma points
    18 days ago
    ٌ
    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 4982 posts 18113 karma points MVP 2x admin c-trib
    18 days ago
    Alex Skrypnyk
    2

    Hi

    Yes, it's super easy

    What property editor do you use for image-picking?

    Alex

  • ٌ 42 posts 202 karma points
    18 days ago
    ٌ
    0

    Media Picker.

  • Alex Skrypnyk 4982 posts 18113 karma points MVP 2x admin c-trib
    18 days ago
    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

  • ٌ 42 posts 202 karma points
    18 days ago
    ٌ
    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 437 posts 1552 karma points c-trib
    18 days ago
    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?

  • ٌ 42 posts 202 karma points
    18 days ago
    ٌ
    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.

  • ٌ 42 posts 202 karma points
    17 days ago
    ٌ
    0

    any idea guys?

  • Frans de Jong 437 posts 1552 karma points c-trib
    17 days ago
    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 4524 posts 5904 karma points MVP 3x admin
    16 days ago
    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?

  • ٌ 42 posts 202 karma points
    1 week ago
    ٌ
    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