-
Notifications
You must be signed in to change notification settings - Fork 118
/
index.js
34 lines (27 loc) · 1.12 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Apply the Design System to a single Drupal behavior
*/
// ECMAScript polyfills, but NOT fetch(). Fetch() is web standard, not ECMAScript.
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import { enableAllComponents } from '../../source/default';
console.log('Particle Drupal behaviors ran.');
Drupal.behaviors.designSystem = {
attach($context, settings) {
// Let's pretend we have a Drupal module called customCarouselModule that
// provides a key on settings called `customCarouselModule` that has a key
// called `interval`. Since this won't exist out of the box, we'll also
// provide a default fallback object: { interval: 5000 }. Change this in
// actual implementation.
const { customCarouselModule = { interval: 5000 } } = settings;
// Provide overrides to components from Drupal settings
const componentSettings = {
carousel: {
interval: customCarouselModule.interval,
},
// .. other component overrides go here
};
// Now enable all components with a custom componentSettings object
enableAllComponents($context, componentSettings);
},
};