Skip to content

FR: ability to query relations based on section-/entry-type #56

@denisyilmaz

Description

@denisyilmaz

It would be great if to be able to add the sectionType/entryType to the query.

Usecase

We have a "Tag" entry type that is used through multiple section types (newsArticle, product etc).
Now on the News Overview page I would like to render the tags that are used by newsArticles only and show a count (how many articles use Tag X).

currently i would get a count of the usage of the tag throughout all types.

Example

{
 entries(type:"tag") {
    ... on tag_Entry {
      title
      # this would only count relations of sectionType "newsArticles"
      relationsField(section:"newsArticles") {
        count
        isInUse
        elements(limit: 2) {
          id
          title
        }
        globalCount: count(siteIds: []),
        globalIsInUse: isInUse(siteIds: []),
        globalElements: elements(siteIds: [], limit:2) {
          id
          title
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions