Closed remcotolsma closed 3 years ago
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):
@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
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 exampleblock.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
Adding the titles was a wild guess, but indeed did not resolve the issue.
@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.
js/dist/blocks/fundraising-progress-circle/block.json
→ Fundraising Progress Circle → https://github.com/pronamic/wp-pronamic-pay-fundraising/blob/develop/js/src/progress-circle/block.jsonjs/dist/blocks/fundraising-progress-bar/block.json
→ Fundraising Progress Bar → https://github.com/pronamic/wp-pronamic-pay-fundraising/blob/develop/js/src/progress-bar/block.jsonjs/dist/blocks/fundraising-progress-text/block.json
→ Fundraising Progress → https://github.com/pronamic/wp-pronamic-pay-fundraising/blob/develop/js/src/progress-text/block.jsonSame 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.
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
.
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 https://github.com/pronamic/wp-pay-core/commit/0def70499e870a12de361c919f44b27992ecbdc3.
https://wordpress.org/plugins/pronamic-ideal/
Why do we see a "Pronamic Pay" block 4 times on https://wordpress.org/plugins/pronamic-ideal/?