-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
PHP APIs Overview #8352
Comments
Note some of these functions depend on resolution to #8244. |
Naming / prefixing was discussed in today's Slack Core Editor meeting: https://wordpress.slack.com/archives/C02QB2JS7/p1534339558000100 tl;dr Tending toward |
Would you consider this a post-merge task? |
Might be good to start a core ticket / patch and keep it going until merge. |
A convenient wrapper for `gutenberg_parse_blocks()` that can be used as a template tag as well, complimentary to `has_blocks()` and `has_block()`. See #8352.
The argument I've heard already is that people who need a full parse can use the PEG parser themselves, when they need it, but as soon as plugins start doing this, we will have sites where multiple passes of the PEG parser are being run by different plugins. At very minimum, we need a way to set a flag to trigger one canonical pass of the PEG parser that various plugins can hook into, rather than each implementing their own... of course, once we have that, the question remains: why isn't the PEG parser just being used on every load? If the block-comment format is meant to be a data structure, it needs to be treated in a structured manner by both PHP and JS, not treated as structured by JS and as a content blob that we scrape with a regex by PHP. |
Closed #4763 in favor of this issue, so it's make sure it's addressed one way or another here. |
Many of these have been implemented, others are in progress, and the rest remain to be fleshed out for future versions. Moving this issue to 5.1. |
Any update regarding #4763? Anxiously awaiting the ability to use |
@jmikrut: Hi. The time is now good to revisit server-side registration of blocks, which is arguably a necessary step for better API-borne block data. See § Action Items in the summary of the last #core-editor chat. |
Many sites are going down a headless WP + React/Vue frontend implementation. It would be beneficial to have a visual representation (block) in WP and have these front-end frameworks handle everything else client side. Littering the front-end with |
+1 to get raw block data instead of rendered html via REST API (or further, GraphQL) |
Any update on "Expose block data directly through REST API endpoints."? |
@aslakagens For an update see the Block Type Registration RFC: https://github.com/WordPress/gutenberg/blob/add/block-registration-rfc/docs/rfc/block-registration.md |
That link is dead btw |
It was moved, because it's implemented and not a RFC anymore: https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/block-api/block-metadata.md |
From all these, the " Expand get_posts filter parameter to allow a blocks as a return shape." is still something I think could be nice to introduce, particularly as server processing has matured and we have REST endpoints now as well. |
Is there any movement or news on being able to access block data in the rest api like royboys gutenberg object plugin does? |
@matt3224 I'm interested to know about this as well. |
Check out #2649 |
It's possible with the followin hook:
It's possible with changes landed in #21467. |
I filed two tickets in WordPress Trac for better visibility of some remaining tasks.
https://core.trac.wordpress.org/ticket/53602
|
I'm going to close this now that the pending items are transferred. |
This issue is an overview on the new PHP APIs remaining to be introduced or extended. Important aspects to keep in mind include internal consistency and consistency with other WP family of functions.
General
*_has_blocks
boolean check.has_block( $block_name )
variation. Add has_block() function #3773has_blocks()
to augment HTML classes likepost_class
. Generate body class for Gutenberg pages & provide helper function #4418, PR Add generic has_blocks function #8631Add block data to REST API (post) response data #4763get_posts
filter parameter to allow ablocks
as a return shape. https://core.trac.wordpress.org/ticket/53602get_post_blocks()
orget_blocks_from_post()
returning an array of blocks with their data. PR Introduce get_blocks function #9208Block API
register_block_type
requirement.Calling render_callback() without register_block_type? #4723Block API: Server-side awareness of block types #2751To Consider
Bugs
The text was updated successfully, but these errors were encountered: