Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #1567232: API improvements for Variable Realm..
After saving a form, information from the "realm selector" is lost, i.e. the user is redirected to the editing form for the default/current realm key.
For example:
- Enable i18n_variable, at least two languages, and configure site slogan to be multilingual
- Navigate to the site information settings form at
admin/config/sytem/site-information
- Select a different language underneith "There are multilingual variables in this form"; (e. g. if current language is English, select German).
- Change a value and click save.
- You are redirected to the form with English values, even though German was selected before submission.
The initial patch solved this via the following snipped (not sure where exactly it would have to go in the current architecture...):
// Make sure the form shown after submission is still the same one
$query_params = array();
foreach ($variables as $name => $realm) {
$query_params[VARIABLE_REALM_SELECTOR_QUERY_PARAM_PREFIX . $realm] = $realms_current[$realm];
}
$form_state['redirect'] = array(current_path(), array('query' => $query_params));
Comments
Comment #1
Jose Reyero CreditAttribution: Jose Reyero commentedDone, similar to the code here, see commit 0bddf855ce40d40ad0c062d6c1582041343144ae