Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block transforms don't have access to inner blocks #13052

Closed
brandonpayton opened this issue Dec 20, 2018 · 7 comments · Fixed by #11979
Closed

Block transforms don't have access to inner blocks #13052

brandonpayton opened this issue Dec 20, 2018 · 7 comments · Fixed by #11979
Labels
[Feature] Block Transforms Block transforms from one block to another [Type] Bug An existing feature does not function as intended
Milestone

Comments

@brandonpayton
Copy link
Member

Describe the bug
Block transform functions receive a block's attributes, but they do not receive inner blocks. This makes it impractical to write transforms for parent blocks that use inner block content.

It's conceivable a plugin might want to offer a transform from a slideshow block to some other kind of block, perhaps a gallery. But this does not appear possible with the current transform API.

Expected behavior
A transform function would receive inner block types and attributes as well.

@brandonpayton brandonpayton added the [Type] Bug An existing feature does not function as intended label Dec 20, 2018
@brandonpayton
Copy link
Member Author

I'm on the fence but marking this as a bug for now.

@designsimply designsimply added the [Feature] Block Transforms Block transforms from one block to another label Dec 21, 2018
@youknowriad youknowriad added this to the WordPress 5.x milestone Jan 29, 2019
@jg314
Copy link
Contributor

jg314 commented Mar 10, 2019

I apologize if this is the wrong place to add this comment. We're building functionality to allow one block to transform into another where both blocks use inner blocks. We're testing this on WordPress 5.1, but the functionality doesn't seem to exist there yet. This was more confusing for us since at https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-registration/#transforms-optional it notes this is possible and provides a code example.

Do you have an idea of when this is going to be part of WordPress core and do you think the documentation should be updated to remove these examples until that time comes?

Thanks a lot for the help.

@jg314
Copy link
Contributor

jg314 commented Mar 15, 2019

I'm following up on my last comment here about inner blocks and the transforms. Let me know if I should be posting somewhere else. Thanks a ton.

@youknowriad
Copy link
Contributor

@jg314 Hi there! this feature will be possible starting from WordPress 5.2 (or by installing the Gutenberg plugin currently).

We have a problem right now with the handbook because it's synchronizing the docs from master.

@jg314
Copy link
Contributor

jg314 commented Mar 18, 2019

Thanks a ton for the response @youknowriad. Is there anywhere we can see which version of the Gutenberg plugin is in core?

@youknowriad
Copy link
Contributor

In Core, there's no direct mapping between Gutenberg versions and the code shipped in Core as sometimes we backport bug fixes. WordPress 5.1 and WordPRess 5.1.1 is based on Gutenberg 4.7 + some fixes.

@jg314
Copy link
Contributor

jg314 commented Mar 18, 2019

Got it. Thanks a lot for the quick response @youknowriad. I really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Transforms Block transforms from one block to another [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants