Drupal Answers Asked by Extect on September 8, 2020
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!
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;
}
Answered by Asif on September 8, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP