Copied to clipboard

Flag this post as spam?

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


  • George Logan 36 posts 168 karma points
    Jul 25, 2019 @ 10:13
    George Logan
    0

    Custom Media Grid Editor - Styles

    Morning,

    I've recently started using Grid layouts on our Umbraco site.

    I've created quite a few custom editors so far, mainly textstrings, and I've been able to apply inline styles to those where needed.

    I'm now trying to create a custom Media editor...

    I've followed - https://our.umbraco.com/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Grid-Layout/Grid-Editors

    enter image description here

    but this appends the height and width to the url - enter image description here

    And i've also tried adding to "style" or "markup" within config - enter image description here

    but none of these are adding the styles inline, to my editor.

    What am I missing?

    Thanks for reading, any help is much appreciated.

  • Marc Goodson 2141 posts 14324 karma points MVP 8x c-trib
    Jul 27, 2019 @ 08:15
    Marc Goodson
    100

    Hi George

    What the 'config' influences in terms of the output of the grid editor depends on the implementation in the view.

    Your config for your custom editor is using the 'media' view

    if you have a look in your solution in the folder

    /views/partials/grid/editors

    you'll find a file called media.cshtml

    and this is where your config is sent, along with the content for the editor to produce the output, and it's here the width and height parameters are being appended.

    So you could copy this file, if your implementation is specific to your new editor (eg you don't want to change all media grid editors!) keep it in the same folder, call it

    LoganMedia.cshtml

    or similar, then in your config you can set the View to be LoganMedia

    Then in LoganMedia, you can output the html for the media as you prefer based on any config values and the content entered by the editor...

    regards

    Marc

  • George Logan 36 posts 168 karma points
    Aug 16, 2019 @ 11:03
    George Logan
    0

    Hi Marc,

    Apologies for the delay in response, I've been on leave and only back this week.

    Haven't yet had a chance to implement this in full, but based on your answer I now have a full understanding of what is required.

    Thanks for taking the time to respond.

    George

Please Sign in or register to post replies

Write your reply to:

Draft