How to autoexpand everything on a view translation edit form?
Question
To fully translate a view into one language I have to expand dozens of collapsed panels, most of them with only one or two subelements.
I've reported it here. But is there a quick workaround, like a module or setting that automatically expands all these panels?
I tried using hook_form_FORM_ID_alter
but changing the #open
value is ignored (note that it's a top-level Displays panel #open
which is true
by default):
/**
* Implements hook_form_FORM_ID_alter().
*/
function custom_admin_form_config_translation_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
foreach ($form['config_names'] as $key => $config_name) {
if (substr( $key, 0, 1 ) !== '#') {
$display = $config_name['display'];
$display['#open'] = false;
}
}
}
Solution
It's set to closed at https://git.drupalcode.org/project/drupal/-/blob/8.9.x/core/modules/config_translation/src/FormElement/ListElement.php#L70
by
'#open' => empty($base_key),
so I'll just add a patch to composer to change it to
'#open' => true,
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange