Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow block attributes passed to block renderer by way of wp_nav_menu. #31911

Conversation

pbking
Copy link
Contributor

@pbking pbking commented May 17, 2021

Description

With the introduction of the block-nav-menus theme support, themes can specify whether to use the navigation block to render classic menus (created via wp_nav_menu). It would be useful to theme developers to be able to set the attributes of the navigation block, e.g. responsiveness.

This change enables block attributes to be passed when calling wp_nav_menu() with block-nav-menus theme support enabled.

How has this been tested?

This change is leveraged by Quadrat. This PR for that theme is passing the value as we expect to be able to.

Types of changes

This simple change passes on to the Navigation Block renderer any attributes passed via the wp_nav_menu function instead of an empty array.

@MaggieCabrera MaggieCabrera merged commit c9b638d into WordPress:trunk May 24, 2021
@github-actions github-actions bot added this to the Gutenberg 10.8 milestone May 24, 2021
@scruffian scruffian deleted the enable-block-attributes-when-outputting-nav-block-markup branch June 30, 2021 10:01
@draganescu
Copy link
Contributor

Howdy friends 👋🏻 Didn't we move this whole location rendering thing to the navigation block's server-side rendering? Why are we depending on what happens in lib/navigation.php?

As @talldan mentions here it is a bad idea to have themes depend on anything related to the block based navigation editor, for multiple reasons:

  • that editor is still experimental
  • even if it graduates from being experimental, it handles a wholly different domain compared to the block

With the introduction of the block-nav-menus theme support, themes can specify whether to use the navigation block to render classic menus (created via wp_nav_menu).

@pbking I think this above is a confusion, because block-nav-menus theme support is meant to allow themes to both build and render their menus with the block, not to "use the block to render classic menus". To use the block to render classic menus we have introduced the __unstableLocation atribute.

Currently I believe this and #33043 should be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants