Problem/Motivation
There are some procedural callbacks that can be deprecated and moved:
- locale_system_set_config_langcodes
- locale_system_update
- locale_system_remove
- locale_form_language_admin_add_form_alter_submit
- locale_form_language_admin_edit_form_alter_submit
Steps to reproduce
Open locale.module
Proposed resolution
Deprecate and move to the appropriate location.
Move locale_system_update and locale_system_remove to protected methods on new LocaleExtensionHooks which contain hooks related to installing and uninstalling extensions.
Move locale_form_language_admin_add_form_alter_submit and locale_form_language_admin_edit_form_alter_submit to public methods on new LocaleFormHooks which contain form related hooks.
locale_system_set_config_langcodes already has a replacement in \Drupal::service('locale.config_manager')->updateDefaultConfigLangcodes()
Remaining tasks
Review
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Issue fork drupal-3595084
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nicxvan commentedComment #4
nicxvan commentedComment #5
nicxvan commentedThis should be ready for review.
I deprecated the 4 functions only used in hooks. I split out the two files related to these new methods.
I also deprecated the function that already has a full replacement.
locale_js_translate is also only used on a hook, but this starting to get larger so I'm not sure if it's appropriate to add here too.
Comment #6
nicxvan commentedClose and update credit when this gets in: https://www.drupal.org/project/drupal/issues/3337900
Comment #7
berdirlocale_js_translate() will then also involve several underscored functions, +1 to a separate issue for that.
great work on the hook class split, much nicer than the always slightly awkward than knowingly not injecting those dependencies.
Comment #8
nicxvan commentedComment #9
berdirThis looks good to me, like that we remove one of the locale system functions completely by registering the same method for two hooks, the other has different arguments, but at least it has a sane name now and is protected.
Comment #10
catchOne locale.module hunk didn't apply but it was for a change that's already been made in HEAD.
Committed/pushed to main, thanks! There are more conflicts against 11.x so we'll need a backport MR for that.
Comment #14
nicxvan commentedThe only conflict was the FormHooks include in locale.module thanks!
Comment #16
catchCommitted/pushed to 11.x, thanks!