Download & Extend

drupal_add_css support for stream wrappers not documented

Project:Drupal core
Version:8.x-dev
Component:documentation
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:needs backport to D7

Issue Summary

The current documentation only indicates that relative paths to css files are supported, however it appears that stream wrapper URIs work fine as well (e.g. public://css_injector/css_injector_1.css).

Support was added here: #927406: Colorable themes fail when CSS aggregation is enabled due to improper stream wrapper usage
A css_injector issue that uses a stream wrapper URI: #1044670: Fix file handling resulting in Incorrect path to css file on Windows

Comments

#1

AttachmentSizeStatusTest resultOperations
drupal-1222794-1.patch1.61 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-1222794-1.patch.View details

#2

Status:needs review» needs work

The last submitted patch, drupal-1222794-1.patch, failed testing.

#3

Here is a proper Git patch.

The only change is the first sentence of the description of the $data parameter when $options['type'] is 'file':

The path to the CSS file relative to the base_path(), e.g., "modules/devel/devel.css".

Changes to

The path to the CSS file relative to the base_path() or a stream wrapper URI, e.g., "modules/devel/devel.css", "public://generated_css/stylesheet_1.css".

AttachmentSizeStatusTest resultOperations
drupal-1222794-3.patch2.04 KBIdlePASSED: [[SimpleTest]]: [MySQL] 35,718 pass(es).View details

#4

Status:needs work» needs review

forgot status change

#5

Version:7.x-dev» 8.x-dev
Status:needs review» needs work

I know this was in the original text wrong, but there's a slight punctuation problem:
wrapper URI, e.g.,
should be
wrapper URI; e.g.,

Actually, I think it should say:

The path to the CSS file relative to the base_path(), or a stream wrapper URI. For example: "modules/devel/devel.css" or "public://generated_css/stylesheet_1.css".

Also, we patch vs. 8.x and backport to 7.x. Thanks!

#6

That's definitely a bit easier to read.

Here's an updated patch for D8.
I was able to cherry-pick the commit without issue, so I'm sure the patch will still apply to D7 cleanly as well.

AttachmentSizeStatusTest resultOperations
drupal-1222794-D8.patch2.05 KBIgnored: Check issue status.NoneNone

#7

Status:needs work» needs review

status

#8

Just noticed some end-of-line whitespace snuck in to the previous patch

AttachmentSizeStatusTest resultOperations
drupal-1222794-8-D8.patch2.05 KBIgnored: Check issue status.NoneNone

#9

Status:needs review» reviewed & tested by the community

To get a patch tested, it can't have a -D# on the patch name (which is noted in the attachment field help text below where you attach files). So, re-uploading the previous patch with a different name.

And the patch looks fine to me for d7/8, as long as the test bot agrees.

AttachmentSizeStatusTest resultOperations
drupal-1222794-8.patch2.05 KBIdlePASSED: [[SimpleTest]]: [MySQL] 33,582 pass(es).View details

#10

Status:reviewed & tested by the community» fixed

Committed and pushed to 8.x and 7.x. Thanks!

#11

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here