Skip to content

Commit

Permalink
Social Link: Fix server-side rendering for legacy format (#20074)
Browse files Browse the repository at this point in the history
Fixes a regression introduced in #19887.

While changing the logic in `register_block_core_social_link` to consume
the block type's `block.json` and switch to the `$service` attribute
name, I broke the handling of the legacy format for social links.

Old format: <!-- wp:social-link-wordpress {"url":"foo"} /-->
New format: <!-- wp:social-link {"service":"wordpress","url":"foo"} /-->

This fixes the handling of legacy social links by providing the adequate
attribute default for each `$service`.
  • Loading branch information
mcsf committed Feb 7, 2020
1 parent c605373 commit bf3042f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ function register_block_core_social_link() {
array_merge(
$metadata,
array(
'attributes' => array(
'url' => array(
'type' => 'string',
),
'service' => array(
'type' => 'string',
'default' => $site,
),
'label' => array(
'type' => 'string',
),
),
'render_callback' => 'render_core_social_link',
)
)
Expand Down

0 comments on commit bf3042f

Please sign in to comment.