You are here

function _quant_quant_option_defaults in Quant 7

Helper function to provide quant option defaults

1 call to _quant_quant_option_defaults()
quant_admin_settings in ./quant.admin.inc
Provide admin settings form

File

./quant.admin.inc, line 134
Admin callbacks

Code

function _quant_quant_option_defaults() {
  $default = array();
  $options = _quant_quant_options();

  // See if visibility settings haven't been set yet
  if (!($default = variable_get('quant_visible', array()))) {
    return array_keys($options);
  }
  else {

    // Iterate the available options to see if there is one that is
    // not present in the visibility options. That can happen if a new
    // quant is available but the settings were set before it was
    foreach ($options as $id => $name) {
      if (!isset($default[$id])) {
        $default[$id] = $id;
      }
    }
  }
  return $default;
}