Closed (outdated)
Project:
Domain
Version:
7.x-3.x-dev
Component:
- Domain Theme
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Jul 2013 at 12:43 UTC
Updated:
2 May 2025 at 12:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
agentrickardLooks good, makes sense.
Comment #2
agentrickardRevised patch. Needs review. My changes are:
* Adds a proper docblock
* Changes the function to
domain_theme_get_setting, as theme_theme looks odd.* Properly checks for existing settings per domain.
* Removes the safe but redundant setting of the $cache['domain_id'] array.
* Changes empty() checks to isset() checks, which are more proper.
Comment #3
stijnstroobantsWas not working for what I need, but fixed a parse error in the patch.
Comment #4
stijnstroobantsSettings in multidimensional arrays were not available.
Changed the function so all settings from the array are available.
Comment #5
agentrickardThe use of this class needs some documentation. new RecursiveIteratorIterator
I don't see how $cache is used here.
Comment #6
mw4ll4c3 commentedThis modified patch does not use the class. The ability to get a single value from within a single setting, while useful in some circumstances, does not mirror the behavior of Core's original theme_get_setting() function.
More importantly, that methodology can pollute the returned settings quite easily.
Consider the following settings:
Iteratively flattening this array absolutely destroys the data through otherwise-safe naming conflicts:
Pardon any mistakes, but you get the idea. The original, accurate values can still be read from within their arrays (if they are not overwritten entirely!) but then there is no point in flattening it.
The patch also moves the "grunt work" into a domain_theme_get_settings() function, which is then called from domain_theme_get_setting() in order to retrieve single values. The _get_settings() result is stored with drupal_static() and cleared when appropriate.
Comment #7
mw4ll4c3 commentedComment #8
agentrickardI'll be honest, it's been years since I looked at this code.
This looks to be an API-level change insofar as it simply adds convenience functions for theme developers, but doesn't change the underlying behavior.
Is that accurate?
Comment #9
mw4ll4c3 commentedI understand -- thank you for ducking back into this for me.
Yes, that is accurate, it does not modify any functionality. It's not strictly for convenience... that said, most cases could probably be worked around, but I did not want this issue to end on a deeply flawed patch!
Worth noting, it seems to only be necessary when the values need to be accessed (very!) early in the theming process, or (potentially?) from within a module doing alterations involving domain_theme (haven't tested on that one, don't have a case involving it, but could probably dream one up...)
But my last patch is flawed! I noticed domain_theme_get_settings doesn't work on the primary domain. That helper wasn't really meant to be called directly, and the main function (domain_theme_get_setting) seems to work (so far) with its theme_get_setting fallback... but I would still like to handle that with more consistency and elegance "just in case."
I'll have an updated patch (and interdiff) within the next few days, hopefully...
Comment #10
mw4ll4c3 commentedComment #11
agentrickardGreat. Thank you!
Comment #12
bluegeek9 commentedDrupal 7 in End of Life and no longer supported. We encourage you to upgrade to a supported version of Drupal. For more information, see https://www.drupal.org/upgrade.