Problem/Motivation

The module only loads the OnPoint Search v2 embed. The script URL and the production search host are hardcoded in the JS, so a site cannot use the v3 embed or point at a non-standard OnPoint Search host.

Steps to reproduce

  1. Install the module and enter a search engine ID for a v3 search engine.
  2. Open the search results page.
  3. The page loads /embed/v2/ from search.onpointsuite.ca. There is no setting to change either.

Proposed resolution

  • Add an "Embed version" setting (v2 or v3.0). v2 stays the default, so existing sites do not change.
  • Add a "Search host" setting, defaulting to the production host.
  • Add one v3 loader script that handles English and French.
  • Apply the module's "Custom CSS" setting on French and v3 results pages too. It was only applied on the English v2 page.
  • Fixes found along the way: path and title changes now apply without a cache clear; fresh installs no longer run the old-module migration; the search query is encoded with encodeURIComponent; the stale .min.js files are removed.
  • Add Kernel and Functional tests.

Remaining tasks

  • Review the merge request.
  • Test v2 and French in a browser.

User interface changes

  • Two new fields on the settings form: "Embed version" and "Search host".
  • "API Key" is relabelled "Search engine ID".
  • Custom CSS containing "<" is rejected with a form error.
  • Site CSS written for the v2 markup needs updating before a site switches to v3.

API changes

None. drupalSettings.onPointSearch gains onPointEmbedVersion and onPointHost.

Data model changes

Two new config keys in onpoint_search.settings: onpoint_embed_version and onpoint_host. An update hook adds them to existing sites with the v2 defaults.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

taylor-northern created an issue.