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

views as fields on nodes #171

Closed
rkoberg opened this issue Jun 28, 2017 · 4 comments
Closed

views as fields on nodes #171

rkoberg opened this issue Jun 28, 2017 · 4 comments

Comments

@rkoberg
Copy link

rkoberg commented Jun 28, 2017

Is there any way to use an view as a entity reference or view reference (https://www.drupal.org/project/viewsreference) or ?? as a field on a node.

Let's say I have a "group" node content type. I also have a "group_post" node content type. The group_post has an entity reference to the group. On the display/graphql of a group node I want to list any associated group_posts. I have a view that does this, but it takes an argument (the group's nid). I have tried using EVA, viewsreference, and regular entity reference to the view. I have set the filter to "This graphql (override)". Graphical sees the new field (as fieldGroupPosts). It is shown as a field that has an array of Strings. Using arguments causes an error (e.g. fieldGroupPosts(filter: {field_group_target_id: "4"}))

Any ideas on how to make this work?

@pmelab
Copy link
Contributor

pmelab commented Jun 29, 2017

I think issue #82 is what you are looking for, am I right?

@rkoberg
Copy link
Author

rkoberg commented Jun 29, 2017

That is part of it. I am talking about adding the view as a field on a content type/node. That does not work. The graphical generated schema shows the type of this view field as an array of Strings (but does not return anything).

@pmelab
Copy link
Contributor

pmelab commented Jun 29, 2017

Yes, thats exactly what #82 is aiming for. It's not implemented yet, but that's what it is supposed to solve.

@rkoberg rkoberg closed this as completed Jun 29, 2017
@das-peter
Copy link

Just a follow up regarding this for the sake of searchability ;)
I've created an extension to #82 which allows explicit configuration where a view is attached: drupal-graphql/graphql-views#20

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

No branches or pull requests

3 participants