0

I am having difficulties to change the library path defined by another module in *.libraries.yml via hook_library_info_alter

Essentially I have one module defining a library component in its *.libraries.yml like that:

# Font Awesome
fontawesome:
  version: 4.7.0
  css:
    component:
      /libraries/fontawesome/css/font-awesome.min.css: {minified: true }

How has my hook to look like to change to path to:

/libraries/fontawesome/web-fonts-with-css/font-awesome.min.css

Thanks for helping me!

0

I pushed my patch for social icons module to add dynamic font awesome css here https://www.drupal.org/project/social_icons/issues/2984954

This is helpful to you.

if (isset($libraries['font-awesome'])) {
     $library_key = key($libraries['font-awesome']['css']['theme']);
     $library_array = $libraries['font-awesome']['css']['theme'][$library_key];
     unset($libraries['font-awesome']['css']['theme'][$library_key]);
     $libraries['font-awesome']['css']['theme'][$font_awesome_url] = $library_array;
}

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.