Compat: Social Links: Remove legacy renderers from packages#20098
Merged
Compat: Social Links: Remove legacy renderers from packages#20098
Conversation
6 tasks
mcsf
commented
Feb 7, 2020
| 'type' => 'string', | ||
| ), | ||
| ), | ||
| 'render_callback' => 'gutenberg_render_core_social_link', |
gziolo
reviewed
Feb 7, 2020
Member
gziolo
left a comment
There was a problem hiding this comment.
Code-wise this is exactly what I expected to see 👍 A nice improvement that we can fully test next week after it is integrated with WordPress core.
lib/blocks.php
Outdated
| * @see https://github.com/WordPress/gutenberg/pull/19887 | ||
| */ | ||
| function gutenberg_register_legacy_social_link_blocks() { | ||
| $sites = array( |
Member
There was a problem hiding this comment.
It probably could be:
Suggested change
| $sites = array( | |
| $services = array( |
but I see why it is called $sites. It's your call what to land.
gziolo
reviewed
Feb 7, 2020
| add_action( 'init', 'gutenberg_reregister_core_block_types' ); | ||
|
|
||
| /** | ||
| * Complements the implementation of block type `core/social-icon`, whether it |
Member
There was a problem hiding this comment.
I like where you are going with this, but I think we decided to leave the old name:
Suggested change
| * Complements the implementation of block type `core/social-icon`, whether it | |
| * Complements the implementation of block type `core/social-link`, whether it |
😃
gziolo
approved these changes
Feb 7, 2020
Member
gziolo
left a comment
There was a problem hiding this comment.
I can confirm it works as expected. When I remove this code, I can't see Social Icons on the frontend with the legacy version saved in the post content. With this patch, everything works as before.
Contributor
Author
|
Hah, thanks for wrapping this one up for me! |
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.
Description
As of #19887, Social Link is implemented as a single block type with multiple variations, whereas previously each supported service (e.g. WordPress, Twitter) was implemented as its own cloned block type:
Old format:
<!-- wp:social-link-wordpress {"url":"foo"} /-->New format:
<!-- wp:social-link {"service":"wordpress","url":"foo"} /-->However, Social Link is defined as a dynamic block. Thus, for backwards compatibility, #19887 preserved the server-side registration of all the "cloned" block types. However, this requirement only applies to the Gutenberg plugin, since Social Links haven't landed in core yet. Thus, this PR moves the server-side registration of cloned block types out of packages — specifically,
block-libraryand intolib/blocks.php.This will ensure that, the next time packages are published and pulled into WordPress core, no added work is needed to make sure that core installations do not register unneeded legacy block types.
How has this been tested?
core/social-linkbut nocore/social-link-xyzclones.Screenshots
Types of changes
Checklist: