Site admins can currently set per-domain variables like 'site_name' via setting the global $conf variable in the domain's PHP init block. This is useful but takes a fair bit of know-how (how to find out the variable names of the pariticular things you want to set, what are appropriate values, etc.).
For usability it would be good to pull some of the most-used options into the per-domain configuration.
Attached patch does so. To accomplish this I've written a small handy helper function that creatss a form array from bits of other forms. I've included site_name, site_slogan, site_footer, and primary and secondary menus. We can easily extend this to pull in more.
By adding these as a nested form array, we can rely on the existing saving to save the data as part of the domain's configuration data.
Two additional changes are needed to make this work. First, on init, we need to iterate through any settings registered for the domain and set $conf appropriately. Second, we need to alter the custom_url_rewrite() implementation so that the domain configuration pages are loaded with the appropriate domain. This second change is needed so that the default values for the domain will be set to the form elements (rather than defaulting to the primary domain's values, which are those actually stored in the variables table).
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | multidomain-variables-config_0.patch | 5.79 KB | nedjo |
| multidomain-variables-config.patch | 3.66 KB | nedjo |
Comments
Comment #1
nedjoApplied the attached updated patch.
Changes and fixes:
1. I'd missed declaring the global $conf in
hook_init(), so the previous version didn't work.2. Add some more configuration options, e.g. site_frontpage, theme_default.
3. Put settings in a fieldset.
4. Settings are saved for a domain only if they are different from the default domain's settings. That way, changes to the default domain's settings will affect all domains except for domains that have previously had custom settings registered, which I think is the expected behaviour.
5. Remove help text for PHP init code about setting $conf, since this is now mainly done through the UI.
Comment #2
(not verified) commented