Remove default values for stylesheet and scripts includes from system module

wonder95 - December 27, 2008 - 06:21
Project:Drupal
Version:7.x-dev
Component:theme system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:Needs design review
Description

Remove the default values for the scripts, stylesheets, and screenshot settings from system_theme_data in system.module. Per Crell:

The declaring of any default for styles and scripts is itself the bug that
needs to be fixed. We didn't realize until after feature freeze that a side
effect of that behavior is that a theme that declares no scripts, for instance,
will therefore implicitly define scripts.js, which removes the scripts.js from
the parent theme. Hilarity ensues.

Instead if the default is to declare nothing, everything works as expected at
the cost of themes needing to be explicit about all of their styles and
scripts. I'd say that's a preferred behavior anyway.

The theme would be required to list default CSS, script, and screenshot files explicitly in the theme.info file.

AttachmentSize
system.module_remove_js_and_stylesheet_defaults.patch469 bytes
Testbed results
system.module_remove_js_and_stylesheet_defaults.patchfailedFailed: Failed to install HEAD. Detailed results

#1

wonder95 - December 28, 2008 - 04:16
Status:active» needs review

#2

System Message - December 28, 2008 - 07:15
Status:needs review» needs work

The last submitted patch failed testing.

#3

wonder95 - December 29, 2008 - 02:13

Hmmm, I was able to install this patch without a problem on my local install. Any chance this was a problem with the test bot?

#4

dmitrig01 - December 29, 2008 - 02:22
Status:needs work» needs review

Requesting retest

#5

Dries - December 29, 2008 - 06:37

I'd be in support of this patch (assuming testing succeeds).

#6

wonder95 - January 20, 2009 - 00:56

Requesting another re-test.

#7

System Message - January 20, 2009 - 01:45
Status:needs review» needs work

The last submitted patch failed testing.

#8

wonder95 - January 21, 2009 - 21:41

New patch with path to system.module modified, also used CVS diff instead of just diff.

AttachmentSize
system.module_remove_js_and_stylesheet_defaults_351487.patch 646 bytes
Testbed results
system.module_remove_js_and_stylesheet_defaults_351487.patchfailedFailed: Failed to apply patch. Detailed results

#9

wonder95 - January 21, 2009 - 21:59
Status:needs work» needs review

OK, let's try this one.

AttachmentSize
system.module_remove_js_and_stylesheet_defaults_351487.patch 631 bytes
Testbed results
system.module_remove_js_and_stylesheet_defaults_351487.patchfailedFailed: Invalid PHP syntax in system.module . Detailed results

#10

System Message - January 21, 2009 - 22:05
Status:needs review» needs work

The last submitted patch failed testing.

#11

wonder95 - January 21, 2009 - 22:35

OK, let's try this again with correct characters in the patch name.

AttachmentSize
system_module_remove_js_and_stylesheet_defaults_351487.patch 631 bytes

#12

lilou - January 22, 2009 - 01:54
Status:needs work» needs review

#13

mfer - January 27, 2009 - 17:42

Can someone explain to me by having defaults here is a bug that needs to have the defaults removed?

What I'm seeing, and please correct me if I'm wrong, is that sub themes that do not declare scripts in their .info file have a scripts.js automatically added and overide the scripts.js file included by the parent theme. This seems like it's the bug.

Wouldn't it be more appropriate to leave the defaults and account for them in _system_theme_data() so this issue doesn't pop up? Therefore leaving the defaults for themers and removing this bug.

I bet if a bunch of themers (not the hard core ones) were polled this would be decreasing the themer experience.

#14

flickerfly - January 27, 2009 - 21:13

I'm thinking fixing this such that defaults remain will save several duplicate bugs in the issue queue. It will certainly be perceived as a loss of feature, not a gain from the themer perspective. It was even mentioned in theme training I attended just this past weekend so it is a known and used feature among themers.

Of course tossing the responsibility of adaptation on the themer isn't a big deal, but why aggravate an entire segment of the drupal community?

#15

mfer - January 27, 2009 - 22:00

@flickerfly better yet, why aggravate the themer part of the drupal community when it's a part of the community we are really attempting to court and grow?

#16

wonder95 - February 23, 2009 - 05:15

I'm not understanding why this would be such a huge aggravation. All the theme creator would have to do is add one line (stylesheets[all][] = style.css) to the .info file. The same is true with scripts.js (scripts[] = scripts.js). That doesn't seem to be too difficult, and it's something the theme creator would have to add, not each person that's using the theme.

See this devel list thread for a discussion on why this is better.

#17

flickerfly - March 19, 2009 - 16:28

It may be simple in practice, but it is an unexpected change and a retraining of the user. Someone who has expected and used that as a feature for a length of time could easily spend a good bit of time figuring out why that doesn't work in 7.x. The people who will deal with this don't float in the issue queue's very often. They aren't programmers and so those are foreign and hard to understand.

I think the options are a marketing campaign to note the change and help people to know about it before it happens or just code it such that it meets everyone's needs. The latter strikes me as the saner of the two. It is a question of community interface, not technology. When you're dealing with end users, unexpected change is always a bad thing and should only be done when it must be done.

It does occur to me that the premise that this matters to themers has yet to be proven. At the risk of splitting the discussion, I've tossed a poll up at http://groups.drupal.org/design-drupal to see if we can get some feedback from the active themers and designers in that group. Maybe I'm making a fuss for nothing. If so, I'll withdraw my objection.

#18

deviantintegral - May 16, 2009 - 23:12

It doesn't look like that poll has received much attention. IMO having default files included in this manner is actually more confusing since it's not incredibly obvious what's included by default and why. For someone new looking at a .info file with many scripts or stylesheets, it would be confusing as to why some files aren't listed.

Here is an updated patch against HEAD, which also fixes _system_theme_data so it doesn't throw notices if 'scripts' or 'stylesheets' aren't defined.

AttachmentSize
system_module_remove_js_and_stylesheet_defaults_351487_18.patch 1.89 KB
Testbed results
system_module_remove_js_and_stylesheet_defaults_351487_18.patchfailedFailed: Failed to apply patch. Detailed results

#19

dixon_ - May 17, 2009 - 00:03
Status:needs review» reviewed & tested by the community

+1 for this patch as it will make the theme system more consistent as previously said.

The patch applies perfectly and works fine. I have tested it with a very simple custom theme. style.css and script.js doesn't get included unless I specify them in mytheme.info, as expected!

Nothing to comment about code style.

#20

Dries - May 17, 2009 - 06:00
Status:reviewed & tested by the community» needs work

I support this patch but we have to update the themes in core. With this patch, the screenshots disappear, for example.

#21

dixon_ - May 17, 2009 - 09:51
Status:needs work» needs review

Okey, here comes an attempt to update the core themes. Don't know if I covered all that had to be changed. Screeshots now appear. That was the only thing I had to change in out three core themes.

AttachmentSize
system_module_remove_js_and_stylesheet_defaults_351487_21.patch 3.52 KB
Testbed results
system_module_remove_js_and_stylesheet_defaults_351487_21.patchfailedFailed: Failed to apply patch. Detailed results

#22

dixon_ - May 17, 2009 - 09:54

Ops, forgot new lines at end of all .info files. Fixed in this patch!

AttachmentSize
system_module_remove_js_and_stylesheet_defaults_351487_22.patch 3.44 KB
Testbed results
system_module_remove_js_and_stylesheet_defaults_351487_22.patchfailedFailed: Failed to apply patch. Detailed results

#23

JohnAlbin - May 17, 2009 - 20:51
Title:Remove defaults values for stylesheet and scripts includes from system module» Remove default values for stylesheet and scripts includes from system module

Actually, per crell's original quote, he doesn't mention screenshot as a problem. And its not. Sub-themes currently inherit screenshots without issue, so we don't need to modify that default setting.

For new themers, we need to explain how to add or override stylesheets by adding lines to the theme’s .info file. Having a default (and hidden) line in the .info file adds clutter to explaining this idea to them.

Also, given Drupal’s usage growth, we will have more new themers than themers who are upgrading from D6 to D7. Plus, our upgrade docs are pretty damn good, IMO. And this patch will necessitate a note in the D7 theme upgrade docs.

This new patch removes the screenshot change.

AttachmentSize
remove-default-stylesheets-351487-23.patch 1.93 KB
Testbed results
remove-default-stylesheets-351487-23.patchfailedFailed: Failed to apply patch. Detailed results

#24

deviantintegral - May 18, 2009 - 18:12

+1 on the patch at #23. I can't seem to find anything in the API docs about info files, so I'm not sure what the procedure for upgrading the docs is. Should http://drupal.org/node/231036 be copied into the D7 handbook and changed as needed?

#25

JohnAlbin - May 26, 2009 - 09:24

+1 on the patch at #23

If you've given it a proper review, please RTBC! :-)

btw, D6->D7 theme upgrade docs are here: http://drupal.org/node/254940

#26

deviantintegral - May 27, 2009 - 02:52
Status:needs review» reviewed & tested by the community

RTBC'ing then!

#27

Dries - May 27, 2009 - 11:43
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Make sure to update the documentation. Thanks!

#28

JohnAlbin - May 27, 2009 - 13:21
Status:fixed» needs work

@todo: Docs need updating at http://drupal.org/node/254940

#29

deviantintegral - June 10, 2009 - 15:43
Status:needs work» fixed

I've updated the documentation, so any further changes can be made on that page.

#30

JohnAlbin - June 12, 2009 - 08:03
Status:fixed» needs review

The patch in #147000: Regression: Unify and rewrite module_rebuild_cache() and system_theme_data() was not re-rolled well after this issue was committed. And it reverted part of this patch.

Here's a new patch which re-applies the changes.

AttachmentSize
followup-351487-30.patch 670 bytes
Testbed results
followup-351487-30.patchpassedPassed: 11415 passes, 0 fails, 0 exceptions Detailed results

#31

JohnAlbin - June 12, 2009 - 14:37
Status:needs review» reviewed & tested by the community

Bot says the patch is good. Marking this RTBC since its already been committed once before.

#32

webchick - June 20, 2009 - 06:14
Status:reviewed & tested by the community» fixed

Committed (again) to HEAD. :) Thanks!

#33

System Message - July 4, 2009 - 06:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.