Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Add handling for image in ACF Media Text block #378

Closed
ravewebdev opened this issue Apr 21, 2021 · 2 comments · Fixed by #384
Closed

Add handling for image in ACF Media Text block #378

ravewebdev opened this issue Apr 21, 2021 · 2 comments · Fixed by #384
Assignees
Labels
bug Something isn't working

Comments

@ravewebdev
Copy link
Contributor

The AcfBlockMediaText component is overriding the image with an empty object currently:

// TODO: Query the DB for the image ID and replace the attributes.data with the correct information.
  attributes.data = {
    ...attributes.data,
    image: {}
  }
@ravewebdev ravewebdev added the bug Something isn't working label Apr 21, 2021
@ravewebdev ravewebdev self-assigned this Apr 21, 2021
@sloyer
Copy link
Contributor

sloyer commented Apr 21, 2021

Thanks for this =)

I have a Gatsby solution that may be able to be converted over.

https://gist.github.com/sloyer/83416d9ed40881044b9901d7483b776f
https://gist.github.com/sloyer/3b03941a255eb0038e5f25244028537a

@ravewebdev ravewebdev mentioned this issue Apr 23, 2021
17 tasks
@sloyer
Copy link
Contributor

sloyer commented Apr 23, 2021

We took a jab at converting what we have, i think i need to convert to use getstaticprops, as Im able to console out img and get the return path in the console but cant get it to render.

Also im not sure how this reacts to having multiple of the same block on the page, i had weird results but it could be my environment.

AcfBlockMediaText.js - https://gist.github.com/sloyer/58d46a1aa983f49199e5cd192332de9c
getImg.js - https://gist.github.com/sloyer/717ac56de6f72e1bf3343ed6fd495959

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants