[wp-trac] [WordPress Trac] #54806: Site Editor: Remote block patterns are not loaded

WordPress Trac noreply at wordpress.org
Mon Jan 17 22:48:19 UTC 2022


#54806: Site Editor: Remote block patterns are not loaded
-------------------------------------------------+-------------------------
 Reporter:  noisysocks                           |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  5.9
Component:  Editor                               |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-testing-info commit    |     Focuses:
  dev-reviewed                                   |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"52594" 52594]:
 {{{
 #!CommitTicketReference repository="" revision="52594"
 Editor: Explicitly load remote block patterns in the block and site editor
 screens.

 Remote block patterns from wp.org were to be loaded through a callback
 hooked into the `current_screen` filter. Within 2 callbacks, i.e.
 `_load_remote_featured_patterns()` and `_load_remote_block_patterns()`, a
 guard clause bailed out early if the `$current_screen->is_block_editor` is
 `false`.

 However, the `current_screen` filter is unreliable to detect the block
 editor. Why? In the block and Site Editor screens,
 `$current_scren->is_block_editor` is not set until after the filter is
 executed. Whoopsie.

 This commit no longer uses the `current_screen` filter. Instead, it
 explicitly loads the remote block patterns by invoking both private
 functions (now not callbacks) directly in the screen files for the block
 and site editor screens.

 With this change, passing `WP_Screen` object into these functions is no
 longer needed. As the `_load_remote_block_patterns()` function was
 introduced in 5.8.0, its function parameter is now deprecated and the
 guard clause retained for backwards compatibility.

 Follow-up to [51021], [52377].

 Props poena, noisysocks, peterwilsoncc, hellofromTonya, audrasjb.
 Merges [52593] to the 5.9 branch.
 Fixes #54806.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54806#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list