[wp-trac] [WordPress Trac] #47620: REST API: Expose blocks registered on the server
WordPress Trac
noreply at wordpress.org
Thu Nov 7 12:10:31 UTC 2019
#47620: REST API: Expose blocks registered on the server
-------------------------------------------------+-------------------------
Reporter: gziolo | Owner:
| spacedmonkey
Type: feature request | Status: assigned
Priority: normal | Milestone: Awaiting
| Review
Component: REST API | Version: 5.0
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses: rest-api
feedback |
-------------------------------------------------+-------------------------
Comment (by spacedmonkey):
> Just a bit of quick feedback, I think we should only have one get_item
route instead of registering a new rest route for each block.
Thanks for the feedback at @TimothyBlynJacobs . I have updated the patch
to not do this anymore see
[https://core.trac.wordpress.org/attachment/ticket/47620/47620.2.diff
47620.2.diff].
> What permissions should be required to access this fields?
Current my patch uses `edit_posts` cap. This api should be available to
everyone that can edit a post, if it is to be used in the mobile app.
`install_plugins` cap is very limiting as by default only administrators
have this cap.
As for the missing fields @gziolo , I wasn't sure of the state of the RFC,
so didn't review it. Can we use this a design for the API?
Currently the API lists off a list of `WP_Block_Type` objects, the
definition of which can we found
[https://github.com/WordPress/WordPress/blob/9b84a21d66d7da3edec388f49234c1c41daed9ad
/wp-includes/class-wp-block-type.php here]. But this class only has the
following properties.
- name
- render_callback
- attributes
- editor_script
- script
- editor_style
- style
The classes doesn't allow for other fields. So these would have to be
added to the class. This is not a small change, as it would require the
updating of the docs / unit tests / implementation of the
[https://developer.wordpress.org/reference/functions/register_block_type/
register_block_type] function. This should likely happen in another
ticket, as this is a sizale change.
Reviewing the document, it seems like the missing fields are.
- title
- category
- parent
- icon
- description
- keywords
- textDomain
- styleVariations
But I would also recommend adding
- supports
I would also look at the newly added
- example
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47620#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list