Skip to content

Provide path instead of just directory name to block.json if not unde…#75012

Open
sque89 wants to merge 1 commit intoWordPress:trunkfrom
sque89:feature/wp-scripts-build-blocks-manifest-nested
Open

Provide path instead of just directory name to block.json if not unde…#75012
sque89 wants to merge 1 commit intoWordPress:trunkfrom
sque89:feature/wp-scripts-build-blocks-manifest-nested

Conversation

@sque89
Copy link
Copy Markdown
Contributor

@sque89 sque89 commented Jan 28, 2026

…r the resolvedInputDir

What?

Follow up to

Use the path instead of just the foldername for a block when generating the blocks-manifest.

Why?

When developing a plugin with multiple blocks that should resemble a parent/child structure it is useful to also reflect that relation within the folder structure. Foe example:

  • build
    • block-a
      • block-b

Currently this structure is flattened in the blocks-manifest and when using it, wordpress does not recognize the nested blocks because the block.json is not being found.

How?

The value that indexes the array of blocks currently is just he foldername of the block. Instead use the full path form the determined input directory.

Testing Instructions

  1. create a plugin with a nested block structure
  2. generate the blocks-manifest and register the blocks via wp_register_block_types_from_metadata_collection
  3. check that all blocks are registered correctly

Testing Instructions for Keyboard

Screenshots or screencast

Before After

@github-actions
Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

1 similar comment
@github-actions
Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 28, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @robins@animalequality.de.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: robins@animalequality.de.

Co-authored-by: sque89 <sque@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@sque89
Copy link
Copy Markdown
Contributor Author

sque89 commented Jan 28, 2026

In https://github.com/WordPress/WordPress/blob/734f2ea9a02b09f320f0ab8188a875bb4be0eba1/wp-includes/class-wp-block-metadata-registry.php#L218 it is mentioned that no normalization is needed because it is only a foldername.

This PR would change that probably therefore an update of the core function is also needed right?

This PR currently works on linux but probably not on windows.

I am quite new to wordpress contribution so what would be the right way to tackle such a dependency?

@sque89 sque89 changed the title provide path instead of just directory name to block.json if not unde… [Type] Enhancement: provide path instead of just directory name to block.json if not unde… Jan 29, 2026
@sque89 sque89 changed the title [Type] Enhancement: provide path instead of just directory name to block.json if not unde… Provide path instead of just directory name to block.json if not unde… Jan 29, 2026
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.

1 participant