Problem/Motivation
Inside the .theme, inside the function ui_suite_dsfr_form_system_theme_settings_alter()
I don't understand the structure of the different element :
- what is the difference between the "ui suite dsfr utilities settings" and the other ?
- Why the "logo_text" is inside the details 'ui_suite_dsfr_settings' but not inside the container of utilities ?
- Why the the 'dsfr_footer_top' is alone ?
Also to clean a bit the .theme I suggest to put all this method inside the theme.settings.php (see
https://www.drupal.org/docs/8/theming-drupal-8/creating-advanced-theme-s... →
)
Put here the code of structure :
$form['ui_suite_dsfr_settings']['ui_suite_dsfr_utilities'] = [
'#type' => 'details',
'#title' => t('UI Suite DSFR Utilities'),
'#open' => TRUE,
];
$form['ui_suite_dsfr_settings']['ui_suite_dsfr_utilities']['container'] = [
'#type' => 'select',
'#title' => t('Container'),
'#default_value' => theme_get_setting('container'),
'#description' => t('Select the type of container that will be used on your site.'),
'#options' => [
'fr-container' => t('Default'),
'fr-container--fluid' => t('Fluid'),
],
];
$colors = _ui_suite_dsfr_get_colors_options();
if (isset($colors)) {
$form['ui_suite_dsfr_settings']['ui_suite_dsfr_utilities']['available_colors'] = [
'#type' => 'select',
'#title' => t('Available colors'),
'#multiple' => TRUE,
'#size' => 12,
'#default_value' => theme_get_setting('available_colors'),
'#description' => t('If no selected - then all will be available. For more info visit <a href="https://gouvfr.atlassian.net/wiki/spaces/DB/pages/217186370/Couleurs+-+palette+-+Color" target="_blank">DSFR Colors</a> page.'),
'#options' => $colors,
];
}
$form['ui_suite_dsfr_settings']['logo_text'] = [
'#type' => 'textfield',
'#title' => t('Logo text for header and footer'),
'#default_value' => theme_get_setting('logo_text'),
];
$form['dsfr_footer_top'] = _menu_settings_form(
t("Footer top menu"),
theme_get_setting('dsfr_footer_top') ?? "account"
);
Proposed resolution
Put all element inside the container of utilities
or
Set new UX things (like container) to know to know what each part's role is (and/or add comment to the code)
Move the function ui_suite_dsfr_form_system_theme_settings_alter inside new theme.settings.php file