Created on 3 October 2024, 3 months ago

Problem/Motivation

The module does not have a configuration schema file at all. If the configuration inspector module is installed for development, it will show the errors.

Steps to reproduce

Install configuration inspector for easy detection. Check the errors from the main Status Report page.

Proposed resolution

Add a schema file at config/schema/search_api_block.schema.yml, with content like this:

block.settings.search_api_form_block:
  type: block_settings
  label: "Search API Block settings"
  mapping:
    action_url:
      type: path
      label: "The search page that the form submits to (e.g. /search). This input supports token values."
    input_name:
      type: label
      label: "The name of the search input. This should be the name of the exposed filter."
    input_placeholder:
      type: label
      label: "The placeholder of the search input."
    submit_value:
      type: label
      label: "The value of the submit button."
    pass_get_params:
      type: boolean
      label: "If this box is checked, any GET parameter added to the Search page URL will be passed as a hidden parameter."
    input_label:
      type: label
      label: "The label of the search input."
    input_label_visibility:
      type: label
      label: "The visibility of the label."

I copied the labels from the help text on the form, so there may be room to improve that, but the core technical requirement of declaring the keys I think is good.

Remaining tasks

pass_get_params was previously being stored, at least in my config, as 0 instead of FALSE. Nothing broke when I applied the schema above, but it continued to show an error for that line in config inspector, until I manually changed in my config from 0 to FALSE. There may be something else that can be done there to programmatically convert that, but it was not a big enough problem that I really felt I needed to spend long on it. Some other modules I use had a similar switch from 0/1 to True/False and didn't provide any update path, so I think it's probably fine as is.

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇨🇦Canada ryanrobinson_wlu

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

Comments & Activities

  • Issue created by @ryanrobinson_wlu
  • 🇨🇦Canada ryanrobinson_wlu

    Ah, good news, it looks like this is already in progress and it just hasn't made it into a release yet! https://git.drupalcode.org/project/search_api_block/-/blob/1.0.x/config/...

    I did the git clone to start to prepare an MR and found a file already there. It is named simply schema.yml instead of search_api_block.schema.yml, the latter of which seems to be the standard practice. Otherwise, please put this into a release once you're confident it's ready.

    I attempted to make a patch to use until that release, but could not seem to get it to work, so I'll have to put up with the errors until the release.

Production build 0.71.5 2024