Enables embedding the MSD Service Finder Tool in Silverstripe projects

Installs: 419

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 7

Forks: 2

Open Issues: 0



1.0.2 2024-04-18 21:09 UTC

This package is auto-updated.

Last update: 2024-06-18 21:30:11 UTC


MSD Service Finder Tool Embed

This module facilitates the inclusion of the Service Finder Tool in a Silverstripe website.

About minified js file and its source code

In order to make updating the embed javascript doable, a source code file embed_source.js is added to the code repo, and the embed.js file is re-minified and compressed by online JS minify tool from

The embed.js is then fully tested and behave as exactly as before.


Include the module code with composer require somardesignstudios/silverstripe-sft-embed.

You can then bind buttons to the Service Finder Tool by adding the default trigger class (.js-service-finder-tool-trigger) to relevant elements via the template helper $ServiceFinderToolTrigger:

<button class="$ServiceFinderToolTrigger">Open Service Finder Tool</button>

The SomarDesignStudios\ServiceFinderTool\ControllerExtension will inject the necessary Javascript into the page when the trigger is used.

Cached content

The normal method will not work correctly if the element is wrapped with partial caching, in which case you will need to follow the steps below to trigger the injection manually.

Via configuration

To force the JavaScript to load on every page; add a configuration file service-finder-tool.yml with the following

Name: servicefindertool
  moduleexists: 'somardesignstudios/silverstripe-sft-embed'
  always_load_script: true

Via manual implementation

If you want to attach the trigger to an element manually (for example, if the target element does not exist in the DOM during page load):

  • Call SomarDesignStudios\ServiceFinderTool\ControllerExtension::requireCoreJS() from your controller to inject the necessary Javascript
  • Bind the tool to a button element by calling window.initServiceFinderTool('<element-css-selector>')

If you need to open the tool from your own Javascript, you can call window.openServiceFinderTool() directly, and you can close it by calling window.closeServiceFinderTool().


This module can allow Javascript from a third-party source, and as such should be treated with a level of caution. Theoretically, this could change at any time. As a result, a copy of the Javascript has been included in the module, which will be periodically updated when the remote script is.

By default, the module will use the baked-in version of the Javascript. To shift to using the remote version, add the following to your config:

  use_remote_js: true

Special Thanks