Domain settings are not saved for setting forms that have #tree set to true:

function some_module_settings_form() {
  $form = array('#tree' => TRUE);
  // Some form elements.
  return system_settings_form($form);
}

This problem can be resolved with a minor change to the domain_settings_form_submit()-handler:

// Original retrieval of the domain id:
$domain_id = $form_state['values']['domain_id'];
// Fix:
$domain_id = empty($form['#tree']) ? $form_state['values']['domain_id'] : $form_state['values']['domain_settings']['domain_id'];

I included a patch which contains the above fix.

CommentFileSizeAuthor
domain-settings-not-saved.patch793 bytesfreblasty

Comments

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)

Do you have Ann example form that you can point to for testing the patch.

freblasty’s picture

Following form is an existing form which is used to configure our proxy settings:

/**
 * Form generator function for 'admin/config/system/webclient-proxy/configure'.
 */
function webclient_proxy_admin_configure_form() {
  $form = array('#tree' => TRUE);
  // Add the default proxy setting.
  $form['webclient_proxy_default_proxy'] = array(
    '#type' => 'select',
    '#title' => t('Default proxy'),
    '#description' => t('Choose the default proxy which is applied to all unsupported requests.'),
    '#options' => webclient_proxy_get_proxies_select(FALSE, TRUE),
    '#default_value' => webclient_proxy_get_default_proxy_setting(),
  );
  // Create reusable select list for all supported requests.
  $proxy = array(
    '#type' => 'select',
    '#title' => t('Proxy'),
    '#description' => t('Which proxy needs to be applied for this supported request.'),
    '#options' => webclient_proxy_get_proxies_select(TRUE, TRUE),
  );
  // Create supported requests container.
  $supported_requests = array(
    '#type' => 'fieldset',
    '#title' => t('Supported WebClient requests.'),
    '#description' => t('A supported WebClient request uses a specific tag to identify itself. Configure which proxy needs to be used when a supported request is found.'),
  );
  // Iterate through supported requests.
  foreach (webclient_proxy_get_supported_requests() as $request_tag => $request_info) {
    // Get the setting for the current request tag.
    $setting = webclient_proxy_get_supported_request_setting($request_tag);
    // Create container element with the request tag name.
    $container = array(
      '#type' => 'fieldset',
      '#title' => check_plain($request_info['name']),
      '#description' => check_plain($request_info['description']),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      'proxy' => $proxy + array('#default_value' => $setting),
    );
    // Add the container to the form.
    $supported_requests[$request_tag] = $container;
  }
  // Add supported requests container.
  $form['webclient_proxy_supported_requests'] = $supported_requests;
  // Create and return the settings form.
  return system_settings_form($form);
}

To fully test to above form checkout my sandbox which contains the module named webclient_proxy: http://drupal.org/sandbox/daeron/1490922

freblasty’s picture

Status: Postponed (maintainer needs more info) » Active
agentrickard’s picture

Thanks!

bluegeek9’s picture

Component: - Domain Settings » Code
Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 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.

//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support of this project makes other volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work contributed to this project, including:
  • Triaging issues and adding more context to existing issues.
  • Writing documentation or patches for this project.