WordPress.org

Make WordPress Core

Opened 7 days ago

Last modified 6 days ago

#49196 new enhancement

Copy block metadata files for dynamic blocks

Reported by: chipsnyder Owned by:
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: javascript Cc:
PR Number:

Description

For dynamic blocks, there are several blocks whose metadata needs to be loaded in PHP. The attributes that are loaded via PHP are not exposed to the ReactNative components when Gutenberg loads the index.js files in the Mobile Apps. To support one master set of metadata that can be used to register in the PHP files and the Javascript files; I'd like to copy over the block.json files with their corresponding PHP files.

This would be a modification here:
https://github.com/WordPress/wordpress-develop/blob/14376be6e195ce9cc7f4bf237651504777b504fb/tools/webpack/packages.js#L97-L109

Suggested change dynamically lookup and block.json files that exist in the paths registered under phpfiles. If the path has a defined block.json file then copy it to wp-includes/blocks/ and rename it to {block-name}.json

Attachments (2)

49196.diff (1.2 KB) - added by chipsnyder 7 days ago.
patch for issue 49196
49196_updated_Jan15.diff (1.2 KB) - added by chipsnyder 6 days ago.
Updated Diff based on the code review in Github

Download all attachments as: .zip

Change History (8)

This ticket was mentioned in PR #131 on WordPress/wordpress-develop by chipsnyder.


7 days ago

@chipsnyder
7 days ago

patch for issue 49196

#2 @prbot
6 days ago

gziolo commented on PR #131:

Thank you for opening this PR. It should be filed in WordPress trac:
https://core.trac.wordpress.org

This is only a mirror of svn repository and it's useful for testing against Continues Integration.

#3 @gziolo
6 days ago

Ooops, I see now that there is a track issue opened :) What a great integration with GitHub!

I left a few comments on GitHub, all of them related to coding styles. Other than that this patch looks good.

#4 @gziolo
6 days ago

  • Focuses javascript added
  • Milestone changed from Awaiting Review to 5.4

#5 @gziolo
6 days ago

At the moment all PHP files are located in one folder:
https://github.com/WordPress/wordpress-develop/tree/master/src/wp-includes/blocks
Given that this patch adds block.json files as well, I think it would be easier to maintain everything if we put every block in its own subfolder.

@chipsnyder
6 days ago

Updated Diff based on the code review in Github

#6 @prbot
6 days ago

chipsnyder commented on PR #131:

Thanks for taking the time to look at it @gziolo. I updated the PR based on the suggestions and updated the diff in the ticket as well. I had failed to read the contributing guide close enough which is why I opened this PR first then added it to the ticket. I can close it after you get a chance to look at the changes :)

Note: See TracTickets for help on using tickets.