Get started with Quant and Drupal
Quant supports Drupal 7, 10 and 11. Release line 1.x is for Drupal 10, release line 2.x is for Drupal 11, and 7.x-1.x is for Drupal 7. Current releases do not support Drupal 9. The codebases are maintained in GitHub and are synced to the Drupal.org QuantCDN project when releases are created. As such, the Drupal.org repo can lag behind the GitHub repo slightly. Issues, feature requests, and pull requests can be raised in GitHub or Drupal.org.
- Download the Quant module via Drupal.org or:
- Drupal 7: Drush (
drush dl quantcdn) - Drupal 11: Composer (
composer require 'drupal/quantcdn:^2.3') - Drupal 10: Composer (
composer require 'drupal/quantcdn:^1')
- Install the module (
drush en quant) which will also install thequant_apisubmodule. Add the submodules that you use in the same command, for exampledrush en quant quant_api quant_webform quant_search -yfor forms (needs the Webform module) and search (needs the Token module). Without Drush, go to Extend (/admin/modules), tick Quant and the submodules you use (Quant API, Quant webform, Quant Search), and click Install. - Recommended: For better performance, update your settings.php file with:
$settings['queue_service_quant_seed_worker'] = 'quant.queue_factory';- Visit the
Configuration > Quantadmin page:
- Drupal 7:
/admin/config/services/quant - Drupal 10, 11:
/admin/config/quant. The Quant pages are tabs of this page. The module’s own tabs (Configure, Seed, Token, Metadata, Queue Info) and the Purger tab are under/admin/config/quant. The tabs that the API, Forms, Search and Cron submodules add are under/admin/config/development/quant.
- Ensure “Track content change” is enabled, and you have all entities enabled that should be automatically pushed to Quant when changes are made.
- Set your “Webserver URL” to the local webserver loopback address (e.g.
http://localhost). Note, this usually starts withhttprather thanhttps. - Set your website domain as the “HTTP Host header” (e.g.
www.example.com). - Check other options on the main configuration page to see if there are other settings you want to update.
- Navigate to the “API” tab (
/admin/config/development/quant/api), choose your platform (QuantCDN or QuantGov) and connect the site in one of these two ways:
- Log in to Quant (module 2.3.0 and later): click Log in to Quant, approve the site in the Quant dashboard (where you can also create a new project for the site), then choose the project this site publishes to. You do not copy a token. See Log in to Quant.
- Connect with a project token: enter your organization, project, and token details. These can be found on the
Integrationspage in the Quant Dashboard. Use the project “API name” for the project, and the project token (not a dashboard API token).
- After you choose the project with Use this project, Drupal shows “This site now publishes to the Quant project …”. Later views of the “API” tab show “Connected to the Quant project …” while the connection works (“Successfully connected to …” before 2.3.0). If not, log in again, or compare your token details with the
Integrationspage in the Dashboard. - If you are still experiencing issues, create a support ticket, so we can help you get set up.
Log in to Quant
Section titled “Log in to Quant”From module 2.3.0 (Drupal 11), an editor can connect the site without copying a token:
- On the “API” tab, choose the platform and click Log in to Quant.
- Sign in to the Quant dashboard if you are not signed in, and approve the site for one or more organizations.
- If the project does not exist yet, tick Create a new project for this site before you approve. Choose the Organisation and check the Project name, which Quant fills in from the site address. The Organisation list shows only the selected organisations where you can add projects and that are active. Leave the box off if the project already exists. With the box ticked, the button reads Create project and allow access.
- Back in Drupal, choose the project. The module then limits its access to that project, so the site can reach only the project it publishes to.
A trial organisation can log in, but you must activate it in billing (add a payment card) before it can create a project. A project created at the login has search off. To use search, open the project settings in the dashboard, turn on Enable search under Features and click Save project. The toggle needs a search subscription.
The module keeps the login outside Drupal configuration, so a configuration export never contains it, and it refreshes the login on cron. Publishing does not depend on the refresh: if the login expires, content still publishes, and the “API” tab asks you to log in again.
- Change project starts a new login. The current project stays connected until you choose the new one.
- Log out of Quant removes the login from the site and ends it in the Quant dashboard. Content is not published until you log in again or connect with a project token.
If Quant refuses to renew the login, the Quant API settings page and the status report say “The Quant login needs renewing”. Content still publishes. Click Log in to Quant again to renew it.
- A copy of the database (for example on a staging site) does not refresh the login of the original site. Log in again on the copy if it needs its own connection.
- Sites that publish several domains to several projects (the Domain module) and sites installed in a subdirectory connect with project tokens.
drush quant:auth-statusshows the platform, the project and the connection method. It never prints a token.
Shield
Section titled “Shield”If you are using the Drupal Shield module (or have other basic authentication enabled on your webserver), then ensure you pass in the username and password in the “Webserver URL” field.
For example if you have username, user, and password, pass, then the Webserver URL value may look like this:
http://user:pass@localhostAPI endpoint
Section titled “API endpoint”From module 2.3.0 the “Platform” choice sets the endpoint: https://api.quantcdn.io for QuantCDN and https://api.quantgov.cloud for QuantGov. A different endpoint can be entered under “Advanced”. Enter the host only, without /v1, because the module adds /v1 to every request.
Before 2.3.0 the “API Endpoint” field is read-only in the form. The default is https://api.quantcdn.io. On QuantGov (https://dash.quantgov.cloud) set the endpoint to https://api.quantgov.cloud:
drush config:set quant_api.settings api_endpoint https://api.quantgov.cloudYou can also set the connection values in settings.php, for example to read the token from an environment variable. The form then shows an “overridden” warning for each value, and a token set in settings.php is used instead of a Quant login.
$config['quant_api.settings']['api_endpoint'] = 'https://api.quantgov.cloud';$config['quant_api.settings']['api_account'] = getenv('QUANT_CUSTOMER');$config['quant_api.settings']['api_project'] = getenv('QUANT_PROJECT');$config['quant_api.settings']['api_token'] = getenv('QUANT_TOKEN');Local web server
Section titled “Local web server”The module fetches each page from the Drupal server with a POST to the “Webserver URL”, sends the “HTTP Host header” as Host, and then pushes the result to Quant. It does not fetch the public domain. If Drupal answers “The provided host name is not valid for this server”, add the “HTTP Host header” value to $settings['trusted_host_patterns']. A command that runs without a web server, such as a one-off container, cannot push content.
What is pushed on change
Section titled “What is pushed on change”With “Track content change” on, saving a published node, taxonomy term or redirect pushes it at the end of the request. Unpublishing the default revision of a node, or deleting an entity, unpublishes the page in Quant. A deleted node or term also loses its /node/N or /taxonomy/term/N redirect. When the alias of a published node or term changes (for example Pathauto after a new title), the old address is unpublished and redirected (301) to the new one; with the Redirect module on, its redirects are pushed instead. Draft revisions are not pushed while “Disable content drafts” is on (the default).
Pushes run after the page is saved, so a failed push is not shown on the save itself. If a push does not reach Quant, editors see a warning on their next page view, and the status report lists the pages. An entry goes away when its page is pushed again. After Quant is back, save the page again or run a seed.
