This is a follow up issue to: #474684: Allow themes to declare dependencies on modules
For a simple example of why this makes sense see: #1286970: Theme Installation Immediately Crashes Site which is a pretty normal support request most base theme maintainers get about once per day. It would be utterly fantastic if this could be back-ported to Drupal 7.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | malformed info.png | 313.83 KB | dcrocks |
Comments
Comment #1
catchSubscribing.
Comment #2
sunDoes this mean you want to make it a requirement to have a base theme enabled if it's used by another theme?
Or in other words: You can't disable a base theme if another theme is enabled that depends on it?
I'd +1 that, just want some clarification here. That said, the issue summary is a bit sparse currently.
Comment #3
Jeff Burnz commentedGood question, right now you don't need to enable the base theme, it just has to be there, however for consistency with modules perhaps it does make sense to force them to be enabled, if a subtheme relies on it.
So perhaps the desired behavior is:
1. You cannot enable a sub-theme if the base theme is missing or disabled.
2. You cannot disable a base theme when a subtheme that is enabled relies on it.
To clarify the motivation for this bug report, to my mind this is mainly a user experience bug, its just far to easy to blow your site up, there is no "forgiveness" in the system like with modules, which at least won't allow you to enable something where the dependencies are missing, gives you helpful "Requires" and "Required by" information, and gives you a nice message and option to enable the dependency when its there and not enabled. Some parity with the modules behavior would clean this up nicely.
Comment #4
dcrocks commentedI am trying to add additional error logic to theme .info file processing in #619542: Malformed theme .info files break menu_router generation and I think I can add this situations as well. The result would be that errors are flagged and the theme can't be enabled until the error is fixed. Would that be a reasonable response to this issue?
Comment #5
dcrocks commentedHere is my latest attempt for #619542: Malformed theme .info files break menu_router generation with a test for missing base themes. I only test if a base theme is missing, not if it exists and is disabled. I think the way module and theme dependencies are actually handled implies they don't need to be treated the same. A module must go thru initialization before its dependent modules can use them properly, while a base theme is really a set of static files that don't need initialization.
Comment #6
dcrocks commentedI just posted a patch for #619542: Malformed theme .info files break menu_router generation that tests to make sure a subtheme's base theme exists and prevents it from being enabled it it doesn't.
Comment #7
yesct commented@catch suggested this might be a better way to fix #986888-57: Undefined index warning in "Available Updates List" with hidden=TRUE base themes
Comment #8
dcrocks commentedIt appears the fix I was talking about is already in drupal8. But I haven't been able to test it because drupal doesn't seem to see any files I place in the drupal/themes directory.
Comment #9
dcrocks commentedOk, I tested and you cannot enable a new theme who's base them doesn't exist. But there are other cases, such as if a base theme to an enabled theme is deleted. I guess I'll do more tests.
Comment #10
dcrocks commentedWell if you have a theme with a basetheme present, enable it, and then delete the base theme there are no errors reported. But then if you set it to default you, of course, get tons of errors. So, I guess it needs to be decided as to how many use cases need to be handled.
Comment #11
mandclu commentedNot sure if this should be a separate issue, but if you try to enable a derivative theme without the base theme enabled, as of today the error message it throws is "The [themename] theme could not be found." which is completely misleading.
Comment #12
rcross commentedComment #13
Jeff Burnz commentedCan we close this now? Not sure its still relevant with all the changes to D8 and base themes get installed automatically and uninstalled also.
Comment #14
markhalliwellYep, #1067408: Themes do not have an installation status took care of this.