Randomg things.
This commit is contained in:
5
web/modules/custom/dc_tests/dc_tests.libraries.yml
Normal file
5
web/modules/custom/dc_tests/dc_tests.libraries.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
testing:
|
||||
js:
|
||||
js/testing.js: {}
|
||||
dependencies:
|
||||
- core/drupal
|
||||
5
web/modules/custom/dc_tests/dc_tests.module
Normal file
5
web/modules/custom/dc_tests/dc_tests.module
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
function dc_tests_preprocess_node(&$variables) {
|
||||
$variables['#attached']['library'][] = 'dc_tests/testing';
|
||||
}
|
||||
10
web/modules/custom/dc_tests/js/testing.js
Normal file
10
web/modules/custom/dc_tests/js/testing.js
Normal file
@@ -0,0 +1,10 @@
|
||||
((Drupal, once) => {
|
||||
Drupal.behaviors.myBehavior = {
|
||||
attach(context) {
|
||||
let target = once('myBehavior', 'body');
|
||||
target.forEach((t) => {
|
||||
alert('Behavior attached test');
|
||||
});
|
||||
},
|
||||
};
|
||||
})(Drupal, once);
|
||||
@@ -0,0 +1 @@
|
||||
<h1>Hello World</h1>
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user