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

PHP APIs Overview #8352

Closed
12 of 16 tasks
mtias opened this issue Aug 1, 2018 · 22 comments
Closed
12 of 16 tasks

PHP APIs Overview #8352

mtias opened this issue Aug 1, 2018 · 22 comments
Labels
[Feature] Block API API that allows to express the block paradigm. Framework Issues related to broader framework topics, especially as it relates to javascript Needs Decision Needs a decision to be actionable or relevant [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues [Type] Task Issues or PRs that have been broken down into an individual action to take
Milestone

Comments

@mtias
Copy link
Member

mtias commented Aug 1, 2018

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

Block API

To Consider

Bugs

@mtias mtias added [Type] Task Issues or PRs that have been broken down into an individual action to take [Feature] Block API API that allows to express the block paradigm. Framework Issues related to broader framework topics, especially as it relates to javascript labels Aug 1, 2018
@mtias
Copy link
Member Author

mtias commented Aug 1, 2018

Note some of these functions depend on resolution to #8244.

@aduth
Copy link
Member

aduth commented Aug 15, 2018

Naming / prefixing was discussed in today's Slack Core Editor meeting:

https://wordpress.slack.com/archives/C02QB2JS7/p1534339558000100

tl;dr Tending toward wp_ prefixing, but favoring consistency where appropriate (i.e. register_block_type without prefix for consistency with existing register_post_type, register_taxonomy, register_rest_route).

@obenland
Copy link
Member

Expand get_posts filter parameter to allow a blocks as a return shape.

Would you consider this a post-merge task? get_post() doesn't have any filters, so I'm not sure how we'd expand it from within the plugin

@mtias
Copy link
Member Author

mtias commented Aug 20, 2018

Would you consider this a post-merge task?

Might be good to start a core ticket / patch and keep it going until merge.

obenland added a commit that referenced this issue Aug 21, 2018
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.
@gschoppe
Copy link

do_blocks() also still needs to be refactored to use the PHP PEG parser, rather than Regular Expressions. having two parallel systems to parse the post content, based on two different technology stacks, is going to lead to a lot of bugs with the small differences between the two implementations, as well as creating a dead end for users who need a proper block parse on page load.

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.

@danielbachhuber
Copy link
Member

Closed #4763 in favor of this issue, so it's make sure it's addressed one way or another here.

@mtias mtias modified the milestones: API Freeze, WordPress 5.0 Nov 1, 2018
@mtias mtias added the Needs Decision Needs a decision to be actionable or relevant label Nov 1, 2018
@mtias mtias added the [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues label Nov 6, 2018
@mtias mtias modified the milestones: WordPress 5.0 RC, Future: 5.1 Nov 12, 2018
@mtias
Copy link
Member Author

mtias commented Nov 12, 2018

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.

@jmikrut
Copy link

jmikrut commented Jan 17, 2019

Any update regarding #4763? Anxiously awaiting the ability to use Block data through the API in a granular manner.

@mcsf
Copy link
Contributor

mcsf commented Jan 18, 2019

@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.

@Legym
Copy link

Legym commented Jan 23, 2019

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 v-html (vue) or dangerouslySetInnerHTML (react) is not ideal because we can't pass state down in a simple manner.

@solidevolution
Copy link

+1 to get raw block data instead of rendered html via REST API (or further, GraphQL)

@aslak-dirdal
Copy link

Any update on "Expose block data directly through REST API endpoints."?

@Soean
Copy link
Member

Soean commented May 28, 2019

@mattpilott
Copy link

@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

@Soean
Copy link
Member

Soean commented Aug 12, 2020

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

@mtias
Copy link
Member Author

mtias commented Aug 25, 2020

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.

@mattpilott
Copy link

Is there any movement or news on being able to access block data in the rest api like royboys gutenberg object plugin does?

@kuasha420
Copy link

@matt3224 I'm interested to know about this as well.

@mtias
Copy link
Member Author

mtias commented Dec 24, 2020

Check out #2649

@gziolo
Copy link
Member

gziolo commented Mar 11, 2021

Ability to register / hook a callback without the non-idiomatic register_block_type requirement.

It's possible with the followin hook:
https://developer.wordpress.org/reference/hooks/register_block_type_args/

Pass the block name to the render callback.

It's possible with changes landed in #21467.

@gziolo
Copy link
Member

gziolo commented Jul 6, 2021

I filed two tickets in WordPress Trac for better visibility of some remaining tasks.

Expand get_posts filter parameter to allow a blocks as a return shape

https://core.trac.wordpress.org/ticket/53602

Expose block data directly through REST API endpoints

https://core.trac.wordpress.org/ticket/53603

@mtias
Copy link
Member Author

mtias commented Jul 13, 2021

I'm going to close this now that the pending items are transferred.

@mtias mtias closed this as completed Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. Framework Issues related to broader framework topics, especially as it relates to javascript Needs Decision Needs a decision to be actionable or relevant [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests