Created
June 24, 2021 19:18
-
-
Save ahebrank/0538722ccec09df07e91211ba5e71b09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/search_autocomplete.libraries.yml b/search_autocomplete.libraries.yml | |
index 7364e72..708ef37 100644 | |
--- a/search_autocomplete.libraries.yml | |
+++ b/search_autocomplete.libraries.yml | |
@@ -7,4 +7,11 @@ search_autocomplete.admin.helper: | |
css/admin_helpers/search_autocomplete.admin.css: {} | |
dependencies: | |
- core/jquery | |
- - core/drupal | |
\ No newline at end of file | |
+ - core/drupal | |
+ | |
+search_autocomplete.autocomplete: | |
+ version: VERSION | |
+ js: | |
+ js/jquery.autocomplete.js: {} | |
+ dependencies: | |
+ - core/jquery.ui.autocomplete | |
\ No newline at end of file | |
diff --git a/search_autocomplete.module b/search_autocomplete.module | |
index 2f2a89e..b7a4357 100644 | |
--- a/search_autocomplete.module | |
+++ b/search_autocomplete.module | |
@@ -55,7 +55,7 @@ function process_search_autocomplete(&$element) { | |
if (!empty($element['#autocomplete_configuration'])) { | |
attach_configuration_to_element($element, $element['#autocomplete_configuration']); | |
$element['#attributes']['class'][] = 'form-autocomplete'; | |
- $element['#attached']['library'][] = 'core/drupal.autocomplete'; | |
+ $element['#attached']['library'][] = 'search_autocomplete/search_autocomplete.autocomplete'; | |
$element['#attributes']['data-key'] = $element['#autocomplete_configuration']; | |
} | |
return $element; | |
@@ -200,17 +200,6 @@ function search_autocomplete_library_info_build() { | |
return $libraries; | |
} | |
-/** | |
- * Implements hook_library_info_alter(). | |
- */ | |
-function search_autocomplete_library_info_alter(array &$libraries, $extension) { | |
- if ($extension == 'core' && isset($libraries['drupal.autocomplete'])) { | |
- $libraries['drupal.autocomplete']['js'] = [ | |
- '/' . drupal_get_path('module', 'search_autocomplete') . '/js/jquery.autocomplete.js' => [], | |
- ]; | |
- } | |
-} | |
- | |
/** | |
* Implements hook_page_attachments(). | |
* | |
@@ -248,7 +237,6 @@ function search_autocomplete_page_attachments(array &$attachments) { | |
attach_configuration_to_element($attachments, $config_id); | |
} | |
- $attachments['#attached']['library'][] = 'core/drupal.autocomplete'; | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment