drupal-graphql / graphql-views

11 stars 18 forks source link

Allow to explicitly attach to an entity type and / or its bundles. #20

Open das-peter opened 6 years ago

das-peter commented 6 years ago

It would be nice if we could extend that automatic detection of "relations" using views arguments to allow to actually configure where a view is attached. This basically is the EVA approach for GraphQL and quite some code has been borrowed from EVA to create this change.

eescribanoc commented 5 years ago

I checked this request and it worked since the moment I get the view as a field inside a node, but I have configured a contextual filter to get information from the Content ID from the URL and the contextual filter doesn't work with the default argument provided you need to specify always the contextual filter in the graphql query. I want to achieve to have a content type "Landingspage" and choose which content types to show in a views that I attached using this patch to the Landingspage bundle and I want the view to get the contextual filter of content type from the node ID that is displayed on. I want to create pages with lists of node of bundles where I can choose with a field in the bundle which content types to show. But forcing the contextual filter in the graphql query make the purpose of being dynamic not possible. I have a view showing related content connected to the same tag as the page you are visiting and that done via a contextual filters and some relations works out of the box, not only displaying the view as a field in the Node but also understanding without setting it in the graphql query the contextual filter needed.

das-peter commented 4 years ago

@eescribanoc The latest patch should go into the direction you were mentioning. The module now supports token arguments & page limit similar to how EVA does that. This means if the view is attached on an entity, you can use a field on that entity to pre-set arguments. This allows that an entity (paragraph item) defines how the query has to be executed e.g. by allowing to select tags in the paragraph which will be used as argument in the query.