Add setting for custom CSS filename

Created on 2 July 2025, 2 months ago
Updated 8 August 2025, 24 days ago

Proposal to allow customization of CSS filenames in module settings. This would let users benefit from this module in multi-site installations when multiple sites use the same theme, without directly integrating with related modules.

<!--break-->

Apologies in advance for any poor issue practices on my part. I'm working on a quick patch and hoping to contribute this upstream, but I'm also interested in the best way to reduce or eliminate the security impact here.

Problem/Motivation

The University of Pittsburgh library system is in the implementation stages of a multi-domain Islandora installation using the domain module β†’ . We're using css_editor to allow the design team to add custom CSS for each domain without needing to customize a theme, and thus significantly reduce maintenance load. We're using a single theme across all sites at the moment, and we do not anticipate a future state in which each site has its own theme. However, the way the CSS editor module determines the filename of custom CSS modules just references the current theme, and in our use case, all use of the CSS editor overwrites all other use of the CSS editor:

https://git.drupalcode.org/project/css_editor/-/blob/2.0.x/css_editor.module?ref_type=heads#L114-115

As a result, the current state is that we have one single custom CSS module across all domains, with all the attendant problems of running multiple sites with different designs off of one CSS file.

Steps to reproduce

Install the domain module alongside the CSS editor module. Use the same theme for more than one of your sites in the multi-site setup. Attempt to use the CSS editor module to edit CSS on one site, then access the CSS editor module from a second site using the same theme.

Proposed resolution

Direct integration with the domain module seems suboptimal. However, the module does split module settings across domains, and as a result an easy solution would seem to be adding a setting in the module configuration for filename. This would automatically allow the domain module to save different file paths for different domains and we could easily differentiate between files.

I'm working on a quick patch that should provide this functionality.

I'm a little wary about adding a new field that would have some impact on file system access and while this isn't my first Drupal rodeo, my Drupal isn't fluent enough to know exactly what the risks might be here. I'd appreciate any advice on that point, whether we implicitly trust users with access to module configuration or if further steps need to be taken.

Remaining tasks

User interface changes

One extra form field in module configuration.

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

Code

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024