Copied to clipboard

Flag this post as spam?

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


  • Damien Holley 179 posts 540 karma points
    Sep 15, 2020 @ 00:33
    Damien Holley
    0

    Display background-image in Block preview

    Hi, I do not wish to override the in-built controller for blocks, but I am having trouble displaying an image in the background of the block.

    I can get the umb://media/ data from block.data.background, but there seems to be no reference anywhere as to what resources are included by default.

    So I need to know how to get the img url using the umb: path, from within the blocks controller.

    like I said above, I do not want to mess-up the in-built controller for blocks by including extra controllers as I can get the simple data inbuilt and do not want to re-invent the wheel or end up with spaghetti-code that is painful to maintain and may break with an update.

    Example:

    <button type="button" ng-click="block.edit()" ng-style="{'background-image':'url('{{block.data.background}}')'">
    <img ng-src="{{block.data.background}}" />
    <div style="width: 100%; display: block; height: 200px; width: 200px">
        <h3 ng-bind="block.data.title"></h3>
        <a ng-bind="block.data.pageLink"></a>
    </div>
    

    pagelink is a content item picked by the content picker.

  • Damien Holley 179 posts 540 karma points
    Sep 16, 2020 @ 05:33
    Damien Holley
    0

    any response on this?

  • Tito 314 posts 623 karma points
    Sep 17, 2020 @ 14:11
    Tito
    0

    I am having the same issue, and looking forward an indepth blog post about the subject. On the release blog post they said will be a blog post about block editor in about 1 week after the release, so it must be near...

  • Damien Holley 179 posts 540 karma points
    Sep 21, 2020 @ 23:51
    Damien Holley
    0

    unfortunately they seem to say there will be something covering this all the time then never do. I guess we'll have to wait and see.

  • Damien Holley 179 posts 540 karma points
    Sep 29, 2020 @ 04:00
    Damien Holley
    100

    Ok there is a tutorial here: Deep Dive on BlockList

    It basically means overriding the controller as I stated I did not wish to do. however it is a kind of solution, please be aware this post is the very basics and does not go into much detail.

Please Sign in or register to post replies

Write your reply to:

Draft