Is it possible to set the fields that are shown/hidden by this module in settings.php, or somewhere else in code? I'd like to be able to use this module on the live site, but on my dev server, see everything, and I'd rather not try to figure out some complicated CSS-based solution...

Comments

dman’s picture

Status: Active » Closed (works as designed)

I see what you are saying.
There may be a more broad module-type solution that can enable/disable modules on a per-host basis (I've not seen it) that would be a general answer to this sort of task.
Me, I have sometimes made additions to settings.php like this:

function system_init() {
  if (! module_exists('beta')) {
    db_query("update system set status = 1 where name = 'beta'");
  }
}

- this example enables the 'beta' module (An early predecessor to Environment indicator - only on my dev site.

However, for more lightweight modules like this one, all the settings are in a variable, and variables are designed to be overridden easily in settings.php, so:

$conf['advancedform_rules_global'] = '';

in your settings.php would disable all rules for you. Same method can be used for a number of other modules that use variable settings.

A more advanced & portable bit of logic would include something like:

if (strstr('dev', $_SERVER['HTTP_HOST'])) {
  // disable stuff on dev.* only
  $conf['advancedform_rules_global'] = '';
}

(Goes in settings.php if you want).

Of course, you can copy&paste the full css rule string there, or a modified version of it, if you want.

This task (in general) is an interesting one, but not worth building a special case into just this particular module. (So "won't fix" right here). Would be good to do as a support module for deployments etc though. Slightly diffferent configs for different sites. But that is (as you've found) currently moderately supported by putting what you want into settings.php. The question is what.

All that said, the purpose of this module is to be useful in the background for admins/devs, and the 'hidden' fields are just a client-side click away anyway...

geerlingguy’s picture

Sounds good! I'll probably use the second example - I already set a few different variables for dev server in settings.php.