chore: refactor codebase using WPGraphQL::get_allowed_{type}( 'objects ')#2356
Merged
jasonbahl merged 3 commits intowp-graphql:developfrom Apr 29, 2022
Merged
Conversation
Collaborator
Author
justlevine
commented
Apr 29, 2022
| } | ||
|
|
||
| // Register a connection from each post type that | ||
| foreach ( $allowed_post_types as $post_type_object ) { |
Collaborator
Author
There was a problem hiding this comment.
I'm unclear why this foreach loop is separate from earlier one on L85.
Collaborator
There was a problem hiding this comment.
ah yes, so the one on line 85 is within the foreach ( $allowed_taxonomies as $tax_object ) { loop.
So, this is getting the intersection of allowed post types for each allowed taxonomy so we can create connections:
- from TaxonomyA -> PostTypeA, etc
This foreach, on line 176 is top level post types, not nested within another foreach.
I'm open to re-thinking how this was done if you have ideas to dry it up or whatever.
|
Code Climate has analyzed commit d85ee38 and detected 7 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this implement/fix? Explain your changes.
This PR builds on #2353, by replacing the previous hydration pattern that used allowed post type / taxonomy names to get their objects, with the updated `WPGraphQL::get_allowed_{type}( 'object' ) method.
e.g this:
becomes this :
Does this close any currently open issues?
no
Any other comments?
$tax_objectin the few places they were using a different variation.Where has this been tested?
Operating System: Ubuntu 20.04 (wsl2 + devilbox + PHP 8.0.15)
WordPress Version: 5.9.3