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.
There is a bug in Drupal core that make the hook_form_system_theme_settings_alter()
function called twice when displaying the settings page for the currently active theme: #1135794: Introduce hook_settings() for themes.
The fact that samara_form_system_theme_settings_alter()
removes the 'theme_settings' entry from the $form array causes a PHP notice on the second pass.
Even if this issue was fixed in the commit c06312a383a7a515c1556c747ceda8765ea93e98, the Drupal core bug is still not resolved.
Because Samara intend to be an administration theme, I think it should take care of that.
Comment | File | Size | Author |
---|---|---|---|
#1 | samara-theme-settings-alter-called-twice-1946236-1.patch | 3.49 KB | B-Prod |
Comments
Comment #1
B-Prod CreditAttribution: B-Prod commentedThe patch below moves the theme settings to a vertical tab and take care of the Drupal core bug explained above.
Comment #2
Chi CreditAttribution: Chi commentedCould you provide steps to reproduce the bug?
Comment #3
B-Prod CreditAttribution: B-Prod commented1. Activate the module
2. Go to the Samara settings page
That's all, with a debugger you can add a breakpoint on the
samara_form_system_theme_settings_alter()
function, you will see that the function is called twice, due to a Drupal core inconsistency.When using Samara old way (vertical tab for theme default settings with
unset()
), this throw an error since the$form['theme_settings']
no more exists in the second pass.The patch above allows to keep use of the vertical tab and take care of the Core bug.
Comment #4
Chi CreditAttribution: Chi commentedCommitted. Thanks!