-
Notifications
You must be signed in to change notification settings - Fork 815
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
Instagram Widget: Remove from legacy-widget block #21050
Instagram Widget: Remove from legacy-widget block #21050
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well. I have 2 remarks though:
- I find the function name (
hide_from_legacy_block
) a bit confusing; I would personally find something likehide_widget_in_block_widget_editor
maybe a bit clearer? - Would it be possible to put the function in the class instead of on its own outside of the class in the same file? I feel it would be cleaner, and would avoid any potential conflicts with functions with the same name in a different plugin.
Also, not for this PR, but I think it would be great if we could have a transform from the legacy widget to the block, to help move away from the widget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the filter into the _construct() and renamed the function
OK, it took me a little digging to understand how to build the Also, the original widget had a title as you can see, but the block doesn't have that option. Should I also add a |
Nicely done, thank you! 👏
Is it possible to port the number of columns and the count to the block, so those settings remain?
Yeah, I think it would make sense to create a new heading block, and then group the heading and the Instagram block. |
What does "keeping them together" mean? |
@simison if you look at the screenshot that I took, when the heading and Instagram blocks are not bundled together in one group they have the propensity to end up in different footer columns. The two need to be nested in a group or column block to keep them together. I am open to other suggestions because this has not been a very fun issue to solve for. |
@arcangelini a solution is coming in Gutenberg 11.5: WordPress/gutenberg#32723 Meanwhile might make sense to get basic transform merged without heading, or by keeping heading separate block? |
The source of the issue is coming from this check. If the block transforming TO does not match the block where it is defined it returns null. This check does not take into account the nested innerBlocks. So any attempt to programmatically add any parent block will break. |
Per @simison suggestion removed the header & group blocks in order to fix current issues. I am working to get the bug in Gutenberg fixed. Not sure on the timeline for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well for me. 🚢 !
4b61be3
to
108d1fb
Compare
…com:Automattic/jetpack into update/instagram-widget-block-compatibility
Deployed on WPCOM: r231968-wpcom The failing test has to do with a core block test that was updated in the diff. |
Great news! One last step: head over to your WordPress.com diff, D66722-code, and commit it. Thank you! |
Summary
With the new current widget block editor, the Instagram Widget does not configure properly. The current Instagram Gallery block already exists and offers the same functions. Rather than fixing the broken widget this PR removes it from the
core/legacy-widget
and adds the widget to the REST API to allow a blocktransform:
to be created.Fixes Automattic/wp-calypso#55344
Changes proposed in this Pull Request:
wpcom_instagram_widget
from legacy-widget blockjetpack/instagram-gallery
blockJetpack product discussion
No discussions
Does this pull request change what data or activity we track or use?
No data changes
Testing instructions:
Instagram (Jetpack)
option is gone