Search by

novicell / premium_tools

novicell-drupal

Premium Tools

Package info

github.com/novicell-drupal/premium_tools

Homepage

Type:drupal-module

pkg:composer/novicell/premium_tools

Statistics

Installs: 546

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

1.4.2 2026-10-29 18:19 UTC

README

The module has no special installation steps. This document will explain what features it provides and how you can use them.

What are the features of this module?

  • Each developer who adds code to this module is responsible for adding a feature description in this file, or providing an example in an example file in the module.

Link with target

The field uses Drupal's standard link validation for URI structure, allowed protocols, internal route validity, access, and the configured link type. It does not check whether an external destination returns HTTP 404.

The Transform API plugin omits stored links that cannot be converted to a URL, so invalid legacy content does not interrupt the page response. Editors should still correct those values.

After updating this module, rebuild Drupal caches (drush cr) so the field plugin's validation constraints are rediscovered. No database update is required.

Regression tests are in tests/src/Kernel and tests/src/Unit. Run them from a Drupal checkout with its test dependencies and Transform API installed:

SIMPLETEST_DB=sqlite://localhost/:memory: vendor/bin/phpunit \
  -c web/core/phpunit.xml.dist web/modules/contrib/premium_tools/tests

Adjust web to the site's document root (for example, webroot).

Ajax Commands

The 'ScrollTo' Ajax Command

  • Purpose:

With this command you can make an ajax form scroll on an action. This is useful when removing/showing new content in an Ajax form.

  • Usage:
  1. Add the library to your form, like so $form['#attached']['library'][] = 'dds_tools/scroll_to_command';
  2. Use the command in your Ajax callback function, like so:
    $response = new JsonResponse();
    $response->addCommand(new ScrollToCommand([
          'selector' => '#selector',
          'header_selectors' => ['.js-header', '.js-main-navigation'],
          'offsetOrPosition' => 'offset',
        ]));
    return $response;

The parameters for the command are as follows: The parameters for the command are as follows:

  • selector: string
    • The selector to scroll to.
  • header_selector: array
    • If the site has a fixed header, give the header class(es) to offset it.
  • offsetOrPosition: string
    • If the scroll should be relative to the document or to the selector.
      • 'offset' is relative to the document
      • '' will default to using jQuery position, relative to the selector.