druxt.js icon indicating copy to clipboard operation
druxt.js copied to clipboard

Add ability to alter module queries.

Open Decipher opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. Most Druxt modules execute a Fetch query against the backend to get required data, but only two of the modules provide any ability to alter the query; DruxtEntity & DruxtViews.

Describe the solution you'd like Make a DruxtModule based solution for altering the queries, with the ability to filter the returned fields, add includes, etc.

Describe alternatives you've considered N/A

Additional context

  • https://www.npmjs.com/package/drupal-jsonapi-params
  • https://github.com/druxt/druxt-entity/blob/develop/src/components/DruxtEntity.vue#L184-L196
  • https://github.com/druxt/druxt-views/blob/develop/src/components/DruxtView.vue#L451-L491

Decipher avatar May 03 '21 01:05 Decipher

Example option for adding includes:

<script>
export default {
  druxt: {
    query: {
      includes: ['RELATIONSHIP_FIELD']
    }
  }
}
</script>

Decipher avatar Oct 21 '21 20:10 Decipher