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

dev: add filters to resolve_content_blocks() #266

Merged

Conversation

justlevine
Copy link
Contributor

What:

This PR adds the wpgraphql_content_blocks_pre_resolve_blocks and wpgraphql_content_blocks_resolve_blocks filters to ContentBlocksResolver::resolve_content_blocks().

Why

Beyond the general DX arguments, this allows local workarounds for the existing bugs without waiting for upstream patches by an understaffed team.

How

  • If wpgraphql_content_blocks_pre_resolve_blocks returns anything but null, the results will be used instead. This is good for swapping out the entire resolver's results without resulting to a messy resolver overloading or forking.
  • wpgraphql_content_blocks_resolve_blocks is used to filter the blocks after the ::resolve_content_blocks() method processes them. This is good for hydrating missing values that the plugin doesnt handle currently/WP 6.5+ regressions.

@justlevine justlevine requested a review from a team as a code owner September 1, 2024 00:17
Copy link

changeset-bot bot commented Sep 1, 2024

🦋 Changeset detected

Latest commit: b64583f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wpengine/wp-graphql-content-blocks Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@justlevine justlevine force-pushed the dev/resolve-content-blocks-filters branch from 1032004 to b64583f Compare September 1, 2024 00:23
@jasonbahl jasonbahl merged commit 61f7908 into wpengine:main Sep 10, 2024
9 of 10 checks passed
@justlevine justlevine deleted the dev/resolve-content-blocks-filters branch September 10, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants