Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 9 months ago

#58577 closed enhancement (fixed)

Backport: rename of reusable blocks to patterns

Reported by: glendaviesnz's profile glendaviesnz Owned by: isabel_brison's profile isabel_brison
Milestone: 6.3 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch has-unit-tests gutenberg-merge
Focuses: Cc:

Description

Renames the Reusable blocks to Patterns. Also adds the option to convert a block or collection of blocks to a non-synced Pattern. This then behaves as imported Patterns do in that once inserted they can be edited completely independently of any other instances of the Pattern. The synced version of the Pattern works as the existing Reusable blocks do in that editing one instance updates all instances.

Change History (13)

This ticket was mentioned in PR #4646 on WordPress/wordpress-develop by @glendaviesnz.


11 months ago
#1

  • Keywords has-patch has-unit-tests added

Renames the Reusable blocks to Patterns. Also adds the option to convert a block or collection of blocks to a non-synced Pattern. This then behaves as imported Patterns do in that once inserted they can be edited completely independently of any other instances of the Pattern. The synced version of the Pattern works as the existing Reusable blocks do in that editing one instance updates all instances.

From: https://github.com/WordPress/gutenberg/pull/51144

Trac ticket: [](https://core.trac.wordpress.org/ticket/58577)

#2 @ramonopoly
11 months ago

  • Component changed from General to Editor
  • Keywords gutenberg-merge added
  • Milestone changed from Awaiting Review to 6.3

@glendaviesnz commented on PR #4646:


11 months ago
#3

Any thoughts on how to best test this? I did look at adding a unit test to tests/phpunit/tests/rest-api/rest-blocks-controller.php but the wp_register_wp_block_postmeta filter is not run for the rest unit tests so the postmeta is not returned there.

@TimothyBlynJacobs commented on PR #4646:


11 months ago
#4

I would say exposing this value through meta is a bit odd for Core. Since this is a first party field, we can expose it as top-level property like sync_status. That'd happen through either modifying the WP_REST_Blocks_Controller or using register_rest_field.

@glendaviesnz commented on PR #4646:


11 months ago
#5

I would say exposing this value through meta is a bit odd for Core. Since this is a first party field, we can expose it as top-level property like sync_status. That'd happen through either modifying the WP_REST_Blocks_Controller or using register_rest_field.

That makes sense @TimothyBJacobs, but would require changes to Gutenberg which I think is about to have the RC version cut. Can we keep it as is for the first beta and update it after that is out? It is a minor implementation detail and doesn't affect the underlying data structure so doesn't seem like it will have any impact to do this as a follow up. What do you think?

@TimothyBlynJacobs commented on PR #4646:


11 months ago
#6

Yep that seems fine to me.

@glendaviesnz commented on PR #4646:


11 months ago
#7

Thanks for the reviews everyone!

#8 @isabel_brison
11 months ago

  • Owner set to isabel_brison
  • Resolution set to fixed
  • Status changed from new to closed

In 56030:

Editor: rename reusable blocks to patterns.

Renames the Reusable blocks to Patterns and adds an option to convert a block or collection of blocks to a non-synced Pattern.

Props glendaviesnz, ramonopoly, peterwilsoncc, timothyblynjacobs, flixos90.
Fixes #58577.

@isabel_brison commented on PR #4646:


11 months ago
#9

Committed in r56030 / b524268.

#10 @mukesh27
10 months ago

#58755 was marked as a duplicate.

#11 @afercia
9 months ago

Just noting that [56030] introduced a string __( 'Add new Pattern' ) where 'new' is lowercase. This is inconsistent with the well established pattern in WordPress, where all similar strings use title case for the word 'New', for example:

__( 'Add New Template' )

Could be fixed in #47125 if the changes proposed there get approved or, alternatively, I think a quick commit would be fine without the need to reopen this ticket or create a new one. Cc @isabel_brison

#12 @isabel_brison
9 months ago

Thanks for the heads up @afercia ! I'll get it fixed :)

Edit: I'll get it fixed _if_ #47125 ends up not making it, but it seems to be on track for 6.4 so I probably won't have to!

Last edited 9 months ago by isabel_brison (previous) (diff)

#13 @afercia
9 months ago

Quickly noting that the lowercase 'n' has been fixed in [56515]. See #47125.

Note: See TracTickets for help on using tickets.