Merged
Conversation
Contributor
Author
|
Just looking at what types of tests are best for this PR. |
|
Size Change: +1.18 kB (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
13 tasks
scruffian
reviewed
Sep 9, 2022
scruffian
reviewed
Sep 9, 2022
draganescu
reviewed
Sep 9, 2022
Contributor
Author
|
Note this comment from @youknowriad on the parent PR. |
Co-authored-by: Ben Dwyer <ben@scruffian.com>
|
Is there any way to get metadata value from blocks in other pages, like metaboxes using meta key? |
Contributor
Author
@bikramchettri The metadata is unrelated to Post Meta. It is an attribute on the block itself. Therefore which ever editor the block ends up in it should still have the metadata associated with it. You can access the metadata roughly as follows: const support = getBlockSupport( blockType, '__experimentalMetadata' );More detail shown in this PR. Be aware this is currently an experimental feature. |
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Spin off from/sub PR of #42605.
Adds block supports for block
metadata.Why?
A use case for this is supplied in #42605. Essentially the need is to store data which is tied to the block instance. For example a custom name/label for the block.
How?
Registers new attribute.
Testing Instructions
Aim is to check that adding support in block.json will cause the block support to be truthy.
packages/block-library/src/group/block.jsonand find thesupportsobject.wp.data.select('core/blocks').getBlockSupport('core/group','__experimentalMetadata'). It should betrue.wp.data.select('core/blocks').getBlockSupport('core/paragraph','__experimentalMetadata'). It should beundefined.Screenshots or screencast