Doc: Fix product editor block template lifecycle doc (#46767)

* Fix action names

* Add missing slash in endpoint URL

* Doc manifest
This commit is contained in:
Matt Sherman 2024-05-23 07:48:39 -04:00 committed by GitHub
parent c318bf50f8
commit fd85199f9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -685,7 +685,7 @@
"menu_title": "Block template lifecycle",
"tags": "reference",
"edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/product-editor-development/block-template-lifecycle.md",
"hash": "8412c1fc634341ef4d4e81cd3212e368acca7e2c8c3ded15de1726cbec88424f",
"hash": "85c88e4c85786405b1eb0436b9e4e478c70ac4dd9ffd08f2a8db256b139ee290",
"url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/product-editor-development/block-template-lifecycle.md",
"id": "0c29c74a7e7e9fd88562df1afa489659f460879e"
}
@ -1266,5 +1266,5 @@
"categories": []
}
],
"hash": "a0932041c53c24ecf0a04c1163d796fbcd204a8e940fa8664fadea0c4bdea153"
"hash": "fe317e6e18998dd7e1936581791d6e949ff59137cd42d5004464093efbca1a88"
}

View File

@ -49,10 +49,10 @@ You can modify template instances in a hook for the following action:
The following actions are fired when blocks are added to or removed from a template, to support extensibility:
- `woocommerce_product_editor_block_template_{template_name}_after_add_block_{block_id}`
- `woocommerce_product_editor_block_template_after_add_block`
- `woocommerce_product_editor_block_template_{template_name}_after_remove_block_{block_id}`
- `woocommerce_product_editor_block_template_after_remove_block`
- `woocommerce_block_template_area_{template_area_name}_after_add_block_{block_id}`
- `woocommerce_block_template_after_add_block`
- `woocommerce_block_template_area_{template_area_name}_after_remove_block_{block_id}`
- `woocommerce_block_template_after_remove_block`
**In order for your action hooks to be called for all block additions and removals for a template, you should call `add_action()` for each of these hooks before the template is instantiated, in or before an `rest_api_init` action hook, priority 9 or lower. If your hooks are not being called, verify that you are hooking them up in an action that is called when REST API endpoints are called.**
@ -60,7 +60,7 @@ See the [Automattic\WooCommerce\Admin\BlockTemplates](https://github.com/woocomm
## Sent to client
A template is sent to the client in the handler for the `/wcv3/layout-templates` REST API endpoint, after the `rest_request_before_callbacks` filter hook.
A template is sent to the client in the handler for the `/wc/v3/layout-templates` REST API endpoint, after the `rest_request_before_callbacks` filter hook.
Any template modification after this point will not be sent to the client.