- Issue created by @kdmdrupal
Core has an example: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/themes/claro/...
So, the library name to override is
user/drupal.user
and you need to specify the correct sub-path to the file. At a glance your first example looks correct.- πΊπΈUnited States kdmdrupal
Thank you for the direction. I will try again.
- πΊπΈUnited States kdmdrupal
After doing more reading on overriding libraries, it turns out what I was trying to do can only be done from a theme info.yml file, and not from a custom module. To override a library from a custom module one has to use hook_library_info_alter.
I have resolved my issue and all is working after implementing the hook_library_info_alter.
Below is what I ended up doing.
function somemodulename_library_info_alter(array &$libraries, $extension) {
if (isset($libraries['drupal.user']['js']) && $extension === 'user'){
unset($libraries['drupal.user']['js']['user.js']);$libraries['drupal.user']['js']['/' . Drupal::service('extension.list.module')->getPath('replacewith odule name') . '/js/replacewithfilename.js'] = [];
}
Thank you for assisting me with this.
- Status changed to Closed: works as designed
over 1 year ago 4:05am 25 August 2023