Add Views filter information / Views Search API support

Created on 9 May 2024, 8 months ago
Updated 13 May 2024, 8 months ago

Problem/Motivation

Example: Creating a view with a taxonomy term filter, want to be able to quickly get the list of available options for filters.

Proposed resolution

Add field filters to the View interface.

User interface changes

Add field to view.

API changes

No existing functionality affected.

Data model changes

{
  testGqlGraphql1(filter: {sticky: true}) {
    id
    view
    filters {
      id
      plugin
      type
      label
      description
      required
      multiple
      value
      attributes
      options
    }
  }
}

Results with information about the expossed filters

{
  "data": {
    "testGqlGraphql1": {
      "id": "e80a31a3-2a84-4568-8f8b-b8bb92f0aabf",
      "view": "test_gql",
      "filters": [
        {
          "id": "field_category_target_id",
          "plugin": "taxonomy_index_tid",
          "type": "select",
          "label": "Category (field_category)",
          "description": "Im an exposed teapot",
          "required": false,
          "multiple": false,
          "value": "All",
          "attributes": [],
          "options": {
            "1": "Bing",
            "2": "Bong",
            "3": "Ding",
            "4": "Dong",
            "All": "- Any -"
          }
        },
        {
          "id": "bingo",
          "plugin": "taxonomy_index_tid",
          "type": "entity_autocomplete",
          "label": "Category (field_category)",
          "description": null,
          "required": false,
          "multiple": false,
          "value": "",
          "attributes": {
            "data-autocomplete-path": "/entity_reference_autocomplete/taxonomy_term/default/sJXIGH0XdS4uc2Ea0_-Wd22bSTCkIwvsjMmfB4qA2eg"
          },
          "options": null
        },
        {
          "id": "title",
          "plugin": "string",
          "type": "textfield",
          "label": "Title",
          "description": null,
          "required": false,
          "multiple": false,
          "value": "",
          "attributes": {
            "placeholder": "Placeholdy"
          },
          "options": null
        },
        {
          "id": "hoho",
          "plugin": "taxonomy_index_tid",
          "type": "checkboxes",
          "label": "Category (field_category)",
          "description": null,
          "required": false,
          "multiple": true,
          "value": [
            "2",
            "3"
          ],
          "attributes": [],
          "options": {
            "1": "A",
            "2": "B",
            "3": "C"
          }
        },
        {
          "id": "sticky",
          "plugin": "boolean",
          "type": "select",
          "label": "Sticky status",
          "description": null,
          "required": true,
          "multiple": false,
          "value": "1",
          "attributes": [],
          "options": {
            "0": "No",
            "1": "Yes"
          }
        }
      ]
    }
  }
}
Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

🇦🇺Australia almunnings Melbourne, 🇦🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024