소스 검색

added boussole js library

bach 2 년 전
부모
커밋
71776320fe

+ 15 - 0
src/web/themes/custom/ouatminimal_theme/js/boussole.js

@@ -0,0 +1,15 @@
+Drupal.behaviors.boussole = {
+  attach: function (context, settings) {
+    console.log("Hello boussole", context);
+    // Use context to filter the DOM to only the elements of interest,
+    // and use once() to guarantee that our callback function processes
+    // any given element one time at most, regardless of how many times
+    // the behaviour itself is called (it is not sufficient in general
+    // to assume an element will only ever appear in a single context).
+    // once('boussoleForm', 'input.myCustomBehavior', context).forEach(
+    //   function (element) {
+    //     element.classList.add('processed');
+    //   }
+    // );
+  }
+};

+ 6 - 0
src/web/themes/custom/ouatminimal_theme/ouatminimal.libraries.yml

@@ -3,3 +3,9 @@ global-styling:
   css:
     theme:
       css/ouatminimal.css: {}
+boussole:
+  version: VERSION
+  js:
+    js/boussole.js: {}
+  dependencies:
+    - core/jquery

+ 1 - 1
src/web/themes/custom/ouatminimal_theme/ouatminimal.theme

@@ -79,7 +79,7 @@ function ouatminimal_theme_suggestions_field_multiple_value_form_alter(array &$s
 function ouatminimal_preprocess_field_multiple_value_form__field_entite__node_concernement(&$variables) {
   // $element = $variables['element'];
   $attributes = $variables['attributes'];
-  
+  $variables['#attached']['library'][] = 'ouatminimal/boussole';
 }
 // template_preprocess_field_multiple_value_form
 // function ouatminimal_preprocess_field_multiple_value_form(&$variables) {