Block Bindings: Add support for Media & Text block image#71610
Block Bindings: Add support for Media & Text block image#71610theminaldiwan wants to merge 1 commit into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @minaldiwan. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
cbravobernal
left a comment
There was a problem hiding this comment.
Hi there!
Thanks for contributing. Unfortunately, the code you provided won't make those block attributes bindables 😅 . Please take a look at this PR:
That won't be merged, but adding new block attributes should be done similarly to that one.
|
@theminaldiwan thanks for the PR! Let's close this PR for now and try a recommended approach if needed. |
This PR adds block bindings support for the Media & Text block’s
mediaIdattribute. as this issue mentioned in #68637With this change, the image inside the Media & Text block can be dynamically sourced (e.g., post featured image, custom fields, or other bindings), rather than being limited to a fixed image or the featured image only.
Why?
Currently, the Media & Text block is useful in templates but restricted in flexibility since the image must either be manually uploaded or set to the featured image.
By enabling block bindings on the
mediaId, template authors and developers can connect the block to other dynamic image sources (e.g., post meta, custom fields, reusable bindings), making it far more versatile for building dynamic templates.How?
mediaIdattribute of the Media & Text block.And we need to below pattern code