[wp-trac] [WordPress Trac] #61902: Block Hooks: `"multiple": false` not respected

WordPress Trac noreply at wordpress.org
Mon Sep 30 12:21:48 UTC 2024


#61902: Block Hooks: `"multiple": false` not respected
-------------------------------------------------+-------------------------
 Reporter:  Bernhard Reiter                      |       Owner:  Bernhard
                                                 |  Reiter
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.7
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests needs-dev-  |     Focuses:
  note                                           |
-------------------------------------------------+-------------------------
Changes (by Bernhard Reiter):

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


Comment:

 In [changeset:"59124" 59124]:
 {{{
 #!CommitTicketReference repository="" revision="59124"
 Block Hooks: Respect `"multiple": false` in hooked blocks.

 If a prospective hooked block has its `multiple` block-supports field set
 to `false` (thus allowing only one instance of the block to be present),
 ensure that:

 1. Only one instance of the block will be inserted if it's not yet present
 in the current context.
 2. The block will not be inserted at all if an instance of it is already
 present in the current context.

 As always in Block Hooks parlance, "context" denotes the containing
 template, template part, pattern, or navigation post that a hooked block
 is supposed to be inserted into.

 The markup of a webpage that uses a Block Theme typically comprises a
 number of such contexts -- one template and any number of template parts,
 patterns, and navigation posts. Note that the limitation imposed by this
 changeset only applies on a per-context basis, so it's still possible that
 the resulting page contains more than one instance of a hooked block with
 `"multiple": false` set, as each context could contribute up to one such
 instance.

 Props bernhard-reiter, jonsurrell, gziolo.
 Fixes #61902.
 }}}

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


More information about the wp-trac mailing list