Feature/#16 attachment root query#141
Merged
jasonbahl merged 5 commits intowp-graphql:masterfrom May 24, 2017
Merged
Conversation
- This adjusts the shape of the attachment (mediaItem) Type definition providing fields relevant to attachments/mediaItems, such as sizes, caption, altText, etc. . . - Also adjusts the post object query test to remove the mimeType query as the field was moved to JUST the mediaItem type
…o feature/wp-graphql#16-attachment-root-query # Conflicts: # src/Type/PostObject/PostObjectType.php
wp-graphql#132 - taxonomy/post_type connections
…s that support “thumbnail” wp-graphql#16 - fixed some bugs with the mediaDetails not resolving properly on mediaItems
Closed
1 similar comment
CodeProKid
reviewed
May 24, 2017
Member
CodeProKid
left a comment
There was a problem hiding this comment.
@jasonbahl just a question on one small thing. Curious of your thoughts.
| 'type' => Types::string(), | ||
| 'description' => esc_html__( 'Type of resource', 'wp-graphql' ), | ||
| 'resolve' => function( \WP_Post $post, $args, $context, ResolveInfo $info ) { | ||
| return wp_attachment_is_image( $post->ID ) ? 'image' : 'file'; |
Member
There was a problem hiding this comment.
I'm wondering if it would be more useful to return the mime type here, rather than just 'image' or 'file' here. We could just use get_post_mime_type() which pulls from the post_mime_type column. Thoughts?
Collaborator
Author
There was a problem hiding this comment.
Trying to have some parity with the WP REST API:
I did follow-up and added mimeType as a field as well though
…the schema test to check for it
Collaborator
Author
|
📸 |
Closed
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.
This hardens the Attachment (mediaItem) Type definition and fixes a few bugs along the way.
Also includes tests for the MediaItem schema
You can now run queries like:
Get a list of mediaItems
Or get the featured image for a specific post