Make library discovery context aware

Created on 2 April 2025, 8 days ago

Problem/Motivation

I created this issue because of https://www.drupal.org/project/gin_toolbar/issues/3293209#comment-15892466 🐛 Library information alter should not be context-aware Closed: outdated .

gin_toolbar injects css to the frontend but those css should be injected only if the user has the proper permissions to see the toolbar. I think there might be other ways of solving this but I liked the approach weblo's take on that linked comment where the library collector is context aware.

Proposed resolution

I think that something like that could never be part of a contrib module, but I wonder if `libraries` and `libraries-extend` cannot be made natively context aware.

Something like:

contexts:
  - user

Then if someone needs to extend the context of any library they current hooks or alterers can be used.

Feature request
Status

Active

Version

11.1 🔥

Component

asset library system

Created by

🇦🇷Argentina hanoii 🇦🇷UTC-3

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024