Make WordPress Core

Opened 9 months ago

Closed 6 months ago

Last modified 4 months ago

#59743 closed enhancement (reported-upstream)

Block Hooks: Allow child insertion into Navigation block

Reported by: bernhard-reiter's profile Bernhard Reiter Owned by:
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

One of the original use cases for Block Hooks was inserting a Login/out block into (i.e. as the last child of) the Navigation block. Ironically, that isn't currently possible, due to the nature of the Navigation block and how it conditionally renders its child blocks or falls back to existing menus.

It's possible to work around this limitation by inserting a hooked block after the Navigation block, which is something we've e.g. done with the Mini Cart example that we've used in some of our documentation, but that's still suboptimal and plainly untenable for a text link such as the Login/out block.

We should try to make this work for 6.5.

Change History (13)

#1 @Bernhard Reiter
9 months ago

cc/ @gziolo @get_dave @ndiego

#2 @sabernhardt
9 months ago

  • Component changed from General to Editor

#3 @Bernhard Reiter
6 months ago

@tomjcafferkey is working on a fix in the GB repo: https://github.com/WordPress/gutenberg/pull/57754.

This ticket was mentioned in PR #5946 on WordPress/wordpress-develop by @Bernhard Reiter.


6 months ago
#4

  • Keywords has-patch added

@Bernhard Reiter commented on PR #5946:


6 months ago
#5

cc/ Editor Tech Leads @getdave @youknowriad

#6 @Bernhard Reiter
6 months ago

  • Milestone 6.5 deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Setting to resolved as resolved-upstream, as this is tackled by https://github.com/WordPress/gutenberg/pull/57754, which has now been merged; the code changes will be carried over by an npm package sync.

The only thing left to do after that has happened will be to update some PHPDoc: https://github.com/WordPress/wordpress-develop/pull/5946

@youknowriad commented on PR #5946:


5 months ago
#7

Is this ready to be committed, what's left here?

@gziolo commented on PR #5946:


5 months ago
#8

Is this ready to be committed, what's left here?

Maybe let's wait for @ockham to confirm. There might be now a bit different approach used.

@Bernhard Reiter commented on PR #5946:


5 months ago
#9

Should be ready to go! Thanks all 😊

#10 @youknowriad
5 months ago

In 57550:

Editor: Update PHPDoc for block bindings's context arg.

The context argument passed to the hooked_block_types filter can also be a Post object
in the case of the navigation block.
This adapts the PHPDoc accordingly.

Props bernhard-reiter, gziolo.
See #59743.

#12 @youknowriad
5 months ago

  • Milestone set to 6.5

This ticket was mentioned in Slack in #core-test by oglekler. View the logs.


4 months ago

Note: See TracTickets for help on using tickets.