Changing library path with hook_library_info_alter

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
  version: 4.7.0
      /libraries/fontawesome/css/font-awesome.min.css: {minified: true }

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


Thanks for helping me!

One Answer

I pushed my patch for social icons module to add dynamic font awesome css here

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];
     $libraries['font-awesome']['css']['theme'][$font_awesome_url] = $library_array;

Answered by Asif on September 8, 2020

Add your own answers!

Related Questions

Make node only accesible by path alias

3  Asked on November 19, 2021 by kevin-ramirez-zavalza


Form and gated content

1  Asked on November 17, 2021 by dataguy


Calculate Star rating based on webform submissions

1  Asked on November 17, 2021 by brainhax


Pager not working when $form[‘table’] is called with AJAX

1  Asked on November 17, 2021 by user3428971


Send message notification when license expired

1  Asked on November 15, 2021 by learner123


View filtering, Relationship Vs Contextual filter

1  Asked on November 15, 2021 by bassem-mohamed


Missing some block fields

1  Asked on November 15, 2021 by metalbearsolid


Custom template for each profile2 profile type edit form

1  Asked on November 13, 2021 by stavovei-ciprian


How to save an image resource

1  Asked on November 13, 2021 by kosher


How to alter node body content through Views pre render hook?

1  Asked on November 11, 2021 by pramodg


Set Default Value for Image Field contain Multiple Images

1  Asked on November 11, 2021 by pglatz


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP