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

WordPress.org » This plugin provides 4 blocks » 4 × "Pronamic Pay" #185

Closed
remcotolsma opened this issue Aug 17, 2021 · 6 comments
Closed

Comments

@remcotolsma
Copy link
Member

https://wordpress.org/plugins/pronamic-ideal/

Schermafbeelding 2021-08-17 om 11 24 45

Why do we see a "Pronamic Pay" block 4 times on https://wordpress.org/plugins/pronamic-ideal/?

rvdsteege added a commit to pronamic/wp-pay-core that referenced this issue Aug 23, 2021
rvdsteege added a commit to pronamic/wp-pronamic-pay-fundraising that referenced this issue Aug 23, 2021
@rvdsteege
Copy link
Member

Because we're registering 4 blocks (1 core and 3 fundraising).

Adding the titles might fix the displayed block names (we'll have to wait and see for next plugin update):

@remcotolsma
Copy link
Member Author

remcotolsma commented Sep 7, 2021

@rvdsteege Was this just a guess, or did you read somewhere that this should fix it?

I searched for the "This plugin provides %d blocks." translation on https://translate.wordpress.org/ and found this:
https://translate.wordpress.org/projects/meta/plugins-v3/nl/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=7524862&filters%5Btranslation_id%5D=64565995

References: https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-blocks.php?marks=41#L41.

I think finding the blocks is handled in https://github.com/WordPress/wordpress.org/blob/3d3cc7df3b9be7a58ab369218b7a7a4eff845547/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php#L733-L797.

It seems that the titles for blocks registered via PHP are not being read?

Is a block.json file for each block the way forward?

Starting in WordPress 5.8 release, we encourage using the block.json metadata file as the canonical way to register block types. Here is an example block.json file that would define the metadata for a plugin create a notice block.

https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/

For WooCommerce I think it's read from the registerBlockType call from for example:
https://plugins.trac.wordpress.org/browser/woocommerce/tags/5.6.0/packages/woocommerce-blocks/build/price-filter.js

@rvdsteege
Copy link
Member

Adding the titles was a wild guess, but indeed did not resolve the issue.

@remcotolsma
Copy link
Member Author

@rvdsteege I think we have to change the build script, store block.json for each block in https://github.com/pronamic/wp-pronamic-pay-fundraising/tree/develop/js/dist.

Same way like in https://plugins.trac.wordpress.org/browser/gutenberg/tags/11.5.1/build/block-library/blocks#calendar.

And start using register_block_type_from_metadata?
https://github.com/WordPress/gutenberg/search?q=register_block_type_from_metadata

Same for the pronamic-pay/payment-form → "Payment Form" block in https://github.com/pronamic/wp-pay-core/search?q=register_block_type.

rvdsteege added a commit to pronamic/wp-pronamic-pay-fundraising that referenced this issue Sep 29, 2021
@rvdsteege
Copy link
Member

Fundraising block.json added and started using register_block_type_from_metadata() (requires WordPress 5.5 or higher):

Issue left open to update payment form block.json.

@rvdsteege
Copy link
Member

Seems that if there are block.json files, *.js and *.php files are not being processed by the wordpress.org plugin directory:

That is why only the fundraising blocks got listed now in the plugin directory. Added block.json for the pronamic-pay/payment-form block in pronamic/wp-pay-core@0def704.

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

No branches or pull requests

2 participants