Problem/Motivation
#2201437: [META-1] Config overrides and language has resulted in a patch that is too large. This issue it to take the patch in #2201437-24: [META-1] Config overrides and language and splits out the parts suggested as:
Way forward? (each step could be a separate issue)
Split the Config class into a couple of base classes so that the functionality can be reused - the attached patch does this and discovered an issue with ThemeSettings not using the same merge method as Config.
.
.
Proposed resolution
- Add new abstract class ConfigBase and abstract subclass StorableConfigBase
- Make Config extend StorableConfigBase
- Make ThemeSettings extend ConfigBase
as initially committed #2201437-24: [META-1] Config overrides and language and suggested to be split out as a separate issue.
Remaining tasks
Complete patch to follow.
User interface changes
None.
API changes
ThemeSettings::mergeData() calls should now call the inherted merge() method.
All current instances of this call to be fixed in this issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | ConfigBaseRefactor (1).png | 30.97 KB | gábor hojtsy |
| #10 | 3-10-interdiff.txt | 584 bytes | eli-t |
| #10 | core-split_config_class-2215413-10.patch | 25.37 KB | eli-t |
| #4 | 1-3-interdiff.txt | 727 bytes | alexpott |
| #3 | core-split_config_class-2215413-3.patch | 25.46 KB | eli-t |
Comments
Comment #1
eli-tAttached patch should implement change in full.
Comment #2
alexpottVery much +1 to this change as it will allow us to reuse StorableConfigBase to manage language overrides without them being overridable!
Also the ThemeSettings tidy up has some nice consequences - namely...
Nice! This is a bug fix - if a theme added a setting with a numeric key it would break because of the old code. Plus reuse of the ConfigBase by everything means that ThemeSettings has way more test coverage too.
This is not really a name especially in with respect to how the configuration system uses the term. ThemeSettings objects are nameless. This is the theme that the settings are for.
Comment #3
eli-tNew patch to address #2215413-2: Split the Config class into StorableConfigBase and ConfigBase. Make ThemeSettings inherit from ConfigBase..
Comment #4
alexpottThanks - this looks good to go
Comment #5
gábor hojtsyNice refactoring, agreed :)
Comment #6
alexpottI should not have rtbc'd this being that it is a rework of my work on #2201437: [META-1] Config overrides and language - reviews please.
Comment #7
gábor hojtsyI reviewed the patch when I posted #5, I think it is totally RTBC.
Comment #8
sunLooks good to me — just one remark:
(and elsewhere)
Could we change the return lines to back to
return $this?I'm aware it is still
$this, but returning it explicitly avoids having to look up what the called method returns (and whether the phpDoc is correct).Comment #9
gábor hojtsyComment #10
eli-tAddressed comments in #2215413-8: Split the Config class into StorableConfigBase and ConfigBase. Make ThemeSettings inherit from ConfigBase.
Comment #11
gábor hojtsyYay, still looks good. Does the same as before. Also @sun-approved[TM]. What more to ask? :)
Comment #12
webchickThis looks straight-forward enough. One more beta blocker down the drain!
Committed and pushed to 8.x. Thanks!
Comment #13
xjmThese are kind of important classes to be missing docblocks altogether. I also don't understand the purpose of this change from reading this issue, the parent issue, or the patch.
Comment #14
alexpott@xjm - good point - created #2216961: Document Config, ConfigBase, and StorableConfigBase to address.
Comment #15
gábor hojtsy@xjm: the most evident benefit is the removal of several copy-pasted methods from
ThemeSettingsand instead rely on actual OOP features :) Here is the before/after picture:Comment #16
gábor hojtsyAlso StorageConfigBase is very useful to do other config storages that may not support overrides for example as proposed by #2201437: [META-1] Config overrides and language for language.
Comment #17
xjmAhh. A picture truly is worth a thousand words.
I still don't get the deal with ThemeSettings, though. Why does it need its own specialflower subclass? Will #1067408: Themes do not have an installation status and friends make this obsolete? And how do we deploy it if it's not storable? Like. What does config that's not storable even mean?
Edit: better discuss this in #2216961: Document Config, ConfigBase, and StorableConfigBase
Comment #18
gábor hojtsy@xjm: the answer to that lies in http://drupalcode.org/project/drupal.git/commitdiff/31513883d9b15c997c14... which was committed from #1712250: Convert theme settings to configuration system. The class is only used for runtime config wrapping. See the theme.inc hunk there for how it merges all kinds of data like global theme settings, theme defaults, etc. to construct the config relevant for this specific theme. This is not storable, it will need to be regenerated based on these things later on. Its derivative data, so the configuration storage system is not really suitable for it.