novicell / premium_tools
Premium Tools
Package info
github.com/novicell-drupal/premium_tools
Type:drupal-module
pkg:composer/novicell/premium_tools
1.4.1
2026-04-10 07:27 UTC
Requires
None
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.
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:
- Add the library to your form, like so
$form['#attached']['library'][] = 'dds_tools/scroll_to_command'; - 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.
- If the scroll should be relative to the document or to the selector.