Problem/Motivation
Nearly every function can now be oop in a class. Let's track the remaining core module files and sub issues to convert them.
Contribution Guide
If you would like to contribute to this initiative thank you!
There are multiple ways you can contribute.
Reviews
- Pick an issue that is in needs review
- Confirm that all api functions are deprecated in 11.5.0 and removed in 13.0.0
- Confirm that all form / batch callbacks and _ functions are deprecated in 11.5.0 and removed in 12.0.0
- Constructor parameters can be deprecated for removal / addition in 12.0.0
- If it is a form callback or underscore function they can be deprecated with no replacement.
- If there is a replacement check the replacement, if there is no replacement review the reasoning for no replacement.
- Pull the branch down and run the command
git diff main --color-moved=dimmed_zebra --color-moved-ws=ignore-all-spaceto compare moved code vs changed code. - Review the shared change record https://www.drupal.org/node/3522207 to confirm that it is included. (If there is an issue specific CR review that)
- Add details of your review to the issue in a comment
Code changes
- Choose a module that does not have an issue
- Create an issue for that module following the template of on of the issues on this #3567618: Create service for image_path_flush, image_style_options and constant for IMAGE_DERIVATIVE_TOKEN
- Add the issue to the list in the remaining tasks section so we don't duplicate efforts
- Ensure this issue is the parent
- Comment that you are working on it
- All functions should be deprecated even _ and form callbacks, though those can be deprecated without replacement
- All functions should be deprecated in 11.5.0 for removal in 13.
- Constructor changes should be deprecated in 11.5.0 for permanent change in 12.
Scope
Dependency injection should only be added in classes that already have it.
Constructor argument deprecations should be for removal in 12.0.0
If a function is deprecated without replacement, then the code block should remain, just add the deprecation comment and trigger error.
Steps to reproduce
N/A
Proposed resolution
When considering the removal version of a deprecated item, follow the policy from Disruptive deprecations should now be scheduled for removal in Drupal 13.0.0, which states:
(...) disruptive deprecations in Drupal 11.3.x and higher should be scheduled for removal in 13.0.0 (rather than 12.0.0).
Potential cases that can still be removed in Drupal 12:
- Constructor parameter additions and removals
Remaining tasks
- file/file.module
- #3375423: Deprecate file_managed_file_save_upload(), file_save_upload() and _file_save_upload_from_form() and replace with a service
- _file_save_upload_from_form
- file_save_upload
- file_managed_file_save_upload
- #1452100: Private file download returns access denied, when file attached to revision other than current
- file_get_file_references #3035352: [PP-1] Deprecate file_get_file_references(). Move the logic to file.usage service
- file_field_find_file_reference_column
- #3375423: Deprecate file_managed_file_save_upload(), file_save_upload() and _file_save_upload_from_form() and replace with a service
- locale/locale.module #3215707: [META] Modernize Locale module
- 15 Constants #2831617: [pp-1] Deprecate global constants in locale module
- Functions:
- Locale system #2660338: Deprecate locale_get_plural
- locale_get_plural
- locale submit callbacks #3595084: Deprecate locale submit callbacks
- 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
- #3037156: Modernize locale history functions
- locale_translation_get_file_history
- locale_translation_update_file_history
- locale_translation_file_history_delete
- locale status #3590050: Deprecate and replace locale_status related functions
- locale_translation_get_status
- locale_translation_status_save
- locale_translation_status_delete_languages
- locale_translation_status_delete_projects
- locale_translation_clear_status
- locale various - to be created
- locale_translation_use_remote_source
- locale_string_is_safe
- locale_translatable_language_list
- locale_js_translate
- locale_translation_language_table
- locale_is_translatable
- locale underscore - to be created
- _locale_refresh_translations
- _locale_refresh_configuration
- _locale_strip_quotes
- _locale_parse_js_file
- _locale_invalidate_js
- _locale_rebuild_js
- Locale system #2660338: Deprecate locale_get_plural
- Includes:
- options/options.module
- options_allowed_values #2171397: Deprecate remaining options.module functions
- _options_values_in_use
- system/system.module
- #3015812: Introduce new Theme extension object and properly deprecate REGIONS_VISIBLE and REGIONS_ALL
- REGIONS_VISIBLE, REGIONS_ALL
- system_region_list
- system_default_region
- #3571172: Deprecate system_sort_themes() and system_check_directory() in system module
- system_sort_themes
- system_check_directory
- system_admin_compact_mode #3584347: Deprecate and replace system_admin_compact_mode()
- _system_is_claro_admin_and_not_active #3579899: Remove remaining claro.theme functions
- system_hook_info (to be removed in 12 via auto deprecation) #3571067: [12.x] Remove hook_hook_info and support in HookCollectorPass
- #3015812: Introduce new Theme extension object and properly deprecate REGIONS_VISIBLE and REGIONS_ALL
- update/update.module
- .module file #3580703: Deprecate update.module functions
- _update_no_data
- update_get_available
- update_create_fetch_task
- update_refresh
- update_fetch_data
- update_fetch_data_finished
- _update_message_text
- _update_project_status_sort
- update_storage_clear
- update.compare.inc #3580705: Deprecate update.compare functions
- update_process_project_info
- update_calculate_project_data
- update_calculate_project_update_status
- update.fetch.inc #3125013: Refactor update.fetch.inc into a MailHandler
- _update_cron_notify
- .module file #3580703: Deprecate update.module functions
- user/user.module
- #3555670: Deprecate user_load_by_mail & user_load_by_name
- user_load_by_mail
- user_load_by_name
- #2012976: Deprecate user_logout() and user_login_finalize() and replace with a service
- user_login_finalize
- user_logout
- user_picture_enabled #3151555: Deprecate user_picture_enabled() reconsider user picture field
- _user_mail_notify #3539178: Extract _user_mail_notify() into a user NotificationHandler
- #3581056: Introduce a OneTimeAuthentication service and deprecate user_pass_rehash
- user_pass_rehash
- user_cancel_url
- user_pass_reset_url
- user_mail_tokens
- #3580682: Create a service for user account cancellation. Convert cancel methods to plugins
- user_cancel
- _user_cancel
- _user_cancel_session_regenerate
- user_cancel_methods
- #2025089: Deprecate user_role_grant_permissions() and user_role_revoke_permissions()
- user_role_change_permissions
- user_role_grant_permissions
- user_role_revoke_permissions
- #3581569: Remove user_cookie_save() and user_cookie_delete()
- user_cookie_save
- user_cookie_delete
- #3582106: Move user_form_process_password_confirm into UserThemeHooks
- user_form_process_password_confirm
- #3555670: Deprecate user_load_by_mail & user_load_by_name
- views/views.module
- views_hook_info (to be removed in 12 via auto deprecation) #3571067: [12.x] Remove hook_hook_info and support in HookCollectorPass
- #3572243: Deprecate several views functions
- views_view_is_enabled
- views_view_is_disabled
- views_enable_view
- views_disable_view
- &views_set_current_view
- &views_get_current_view
- views_embed_view
- views_get_view_result
- _views_query_tag_alter_condition
- views_element_validate_tags
- views_add_contextual_links #2571679: Replace views_add_contextual_links() in views.module with service
- views_invalidate_cache #941970: Only set router rebuild needed when something related to routing actually changes
Deprioritized since they are slated for removal
- search/search.module #3565780: [meta] Tasks to deprecate the Search module
- search_excerpt
- _search_find_match_with_simplify
- settings_tray/settings_tray.module #3576315: [policy, no patch] Move Settings Tray to a contributed project
- _settings_tray_has_block_overrides #3570234: Deprecate and move _settings_tray_has_block_overrides
- shortcut/shortcut.module #3569117: [meta] Tasks to deprecate the Shortcut module
- shortcut_set_edit_access
- shortcut_set_switch_access
- shortcut_renderable_links
- toolbar/toolbar.module #3484850: [meta] Tasks to deprecate Toolbar module
- toolbar_menu_navigation_links
- toolbar_get_rendered_subtrees
- _toolbar_get_subtrees_hash
No more action needed
- automated_cron/automated_cron.module
- block/block.module
- block_theme_initialize: #3566782: Deprecate block_theme_initialize() and move the logic to a service
- 1 deprecated function
- block_content/block_content.module
- block_content_has_reusable_condition: #3566776: Move _block_content_has_reusable_condition() to a protected method
- 2 deprecated functions
- ckeditor5/ckeditor5.module #3566792: Deprecate remaining ckeditor5.module procedural code
- ckeditor5_filter_format_edit_form_submit
- _update_ckeditor5_html_filter
- _ckeditor5_theme_css
- 1 deprecated function
- comment/comment.module
- _comment_entity_uses_integer_id: #3566801: Helper to check if the entity type's ID is integer
- comment_preview #3566879: Deprecate comment_preview() logic to CommentForm
- 2 deprecated functions
- contact/contact.module
- content_translation/content_translation.module #3566890: Deprecate and remove procedural code from content_translation.module
- _content_translation_install_field_storage_definitions
- content_translation_translate_access
- content_translation_enable_widget
- content_translation_language_configuration_element_process
- content_translation_language_configuration_element_validate
- content_translation_language_configuration_element_submit
- 1 deprecated function
- contextual/contextual.module #3568087: Deprecate procedural code from contextual.module
- _contextual_links_to_id
- _contextual_id_to_links
- datetime/datetime.module
- 1 deprecated function
- dblog/dblog.module
- editor/editor.module
- #3568092: Convert editor.module procedural submit, validate and Ajax callbacks to methods
- editor_form_filter_admin_format_editor_configure
- editor_form_filter_admin_form_ajax
- editor_form_filter_admin_format_validate
- editor_form_filter_admin_format_submit
- editor_filter_xss #3568144: Convert editor_filter_xss() to a element.editor service method
- #3568101: Remove editor.module underscore functions in 12.x, deprecate in 11.x. Move the logic in EditorHooks
- _editor_record_file_usage
- _editor_delete_file_usage
- _editor_get_file_uuids_by_field
- _editor_get_formatted_text_fields
- _editor_parse_file_uuids
- 1 deprecated function
- editor.admin.inc file #3570917: Deprecate editor_image_upload_settings_form() and move the logic to a service
- editor_image_upload_settings_form
- #3568092: Convert editor.module procedural submit, validate and Ajax callbacks to methods
- field/field.module #3572173: Deprecate field.module remaining functions
- _field_create_entity_from_ids
- field_form_field_config_edit_form_entity_builder
- field.purge.inc #2907780: Add a field purger service
- field_purge_batch
- field_purge_field
- field_purge_field_storage
- field_ui/field_ui.module
- 1 Form callback: #3567163: Move field_ui form callback to hook class
- filter/filter.module
- #2536594: Add a FilterFormatRepository providing methods to load filter formats
- filter_formats
- filter_formats_reset
- filter_get_roles_by_format
- filter_get_formats_by_role
- filter_default_format
- filter_fallback_format
- check_markup #455724: Deprecate check_markup()
- _filter_tips #3580662: Deprecate _filter_tips()
- #3226806: Move filter implementations from filter.module to plugin classes
- _filter_autop
- _filter_url
- _filter_html_image_secure_process
- _filter_url_parse_full_links
- _filter_url_parse_email_links
- _filter_url_parse_partial_links
- _filter_url_escape_comments
- _filter_url_trim
- _filter_html_escape
- #2536594: Add a FilterFormatRepository providing methods to load filter formats
- help/help.module
- _help_search_update #3567616: Move _help_search_update to hook
- image/image.module #3567618: Create service for image_path_flush, image_style_options and constant for IMAGE_DERIVATIVE_TOKEN
- IMAGE_DERIVATIVE_TOKEN
- image_path_flush
- image_style_options
- inline_form_errors/inline_form_errors.module
- _inline_form_errors_set_errors #3568063: Move _inline_form_errors_set_errors to themeHookClass
- jsonapi/jsonapi.module
- Only deprecated constants
- language/language.module #3574727: Deprecate remaining language.module code
- language_process_language_select
- language_configuration_element_submit
- language_get_default_langcode
- language_negotiation_url_prefixes_update
- language_get_browser_drupal_langcode_mappings
- layout_discovery/layout_discovery.module
- Only deprecated functions
- link/link.module
- Only deprecated functions
- media/media.module
- #3568124: Deprecate remaining functions in media.module
- _media_get_add_url
- media_filter_format_edit_form_validate
- media_library/media_library.module #3570839: Deprecate remaining underscore functions in media_library.module
- _media_library_views_form_media_library_after_build
- _media_library_media_type_form_submit
- _media_library_configure_form_display
- _media_library_configure_view_display
- menu_link_content/menu_link_content.module
- _menu_link_content_update_path_alias #3570863: Deprecate _menu_link_content_update_path_alias
- menu_ui/menu_ui.module - #3571400: Deprecate functions in menu_ui.module and move to hooks or helper class
- _menu_ui_node_save
- menu_ui_get_menu_link_defaults
- menu_ui_node_builder
- menu_ui_form_node_form_submit
- menu_ui_form_node_type_form_validate
- menu_ui_form_node_type_form_builder
- navigation/navigation.module
- Only deprecated functions
- node/node.module #3532197: [meta] Deprecate node.module functions
- node_access_grants #2473041: Restructure node access grant behavior into the node access handler
- #3533299: Deprecate node access rebuild functions
- node_access_needs_rebuild
- node_access_rebuild
- _node_access_rebuild_batch_operation
- _node_access_rebuild_batch_finished
- node_access_grants #2473041: Restructure node access grant behavior into the node access handler
- responsive_image/responsive_image.module
- Only deprecated functions
- syslog/syslog.module #3570235: Deprecate functions in syslog.module
- syslog_logging_settings_submit
- syslog_facility_list
- taxonomy/taxonomy.module #3570238: Deprecate remaining functions in taxonomy
- taxonomy_build_node_index
- taxonomy_delete_node_index
- text/text.module
- views_ui/views_ui.module
- #3039248: Deprecate views_ui_contextual_links_suppress(), views_ui_contextual_links_suppress_push(), views_ui_contextual_links_suppress_pop()
- views_ui_contextual_links_suppress
- views_ui_contextual_links_suppress_push
- views_ui_contextual_links_suppress_pop
- admin.inc #3035340: Deprecate core/modules/views_ui/admin.inc
- #3039248: Deprecate views_ui_contextual_links_suppress(), views_ui_contextual_links_suppress_push(), views_ui_contextual_links_suppress_pop()
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Comments
Comment #2
nicxvan commentedComment #3
nicxvan commentedComment #4
nicxvan commentedComment #5
nicxvan commentedComment #6
claudiu.cristeaShould we deprecate the procedural functions being converted? For instance, looking at
automated_cron.modulewhich contains theautomated_cron_settings_submit()function. Should we assume that a 3rd-party is calling that function? Deprecate or just remove?Comment #7
claudiu.cristeaComment #8
claudiu.cristeaComment #9
claudiu.cristeaComment #10
claudiu.cristeaComment #11
claudiu.cristeaComment #12
claudiu.cristeaComment #13
nicxvan commentedGood questions in 6!
Form callbacks typically don't need deprecation but should use this new pattern https://www.drupal.org/node/3548821 then we don't need to make them static and can use dependency injection.
Underscore usually don't need deprecation either.
But can require deprecation in a case by case basis!
Comment #14
claudiu.cristeaComment #15
claudiu.cristeaComment #16
claudiu.cristeaComment #17
dwwThanks @nicxvan for opening this and to @claudiu.cristea for diving in to move it forward. Per Slack (but posting here for better visibility), I think it'd be better to do 1 issue per module whenever possible, instead of multiple (probably conflicting) issues for separate functions in the same .module file.
Exceptions to the above would include things like update.module (😅😬😊) that still have 500 loc, a big mix of different kinds of procedural functions (some already deprecated, many not), including helper methods, stuff related to fetching update data, and a few other odds and ends. In that case, I'd probably open separate issues for consolidating all the data fetching code into the
UpdateFetcherservice, another issue for UI-related helper methods, and maybe a 3rd for_update_project_status_sort(). Maybe another forupdate_storage_clear(). 😂 More or less...But generally, probably only need 1 issue per .module file.
Thanks again!
-Derek
Comment #18
nicxvan commentedComment #19
nicxvan commentedComment #20
claudiu.cristeaComment #21
claudiu.cristeaComment #22
claudiu.cristeaComment #23
nicxvan commentedComment #24
nicxvan commentedComment #25
nicxvan commentedComment #26
nicxvan commentedComment #27
nicxvan commentedComment #28
nicxvan commentedComment #29
nicxvan commentedComment #30
nicxvan commentedComment #31
nicxvan commentedComment #32
nicxvan commentedComment #33
nicxvan commentedComment #34
nicxvan commentedComment #35
nicxvan commentedComment #36
joachim commentedComment #37
claudiu.cristeaComment #38
nicxvan commentedComment #39
nicxvan commentedComment #40
nicxvan commentedComment #41
nicxvan commentedComment #42
joachim commentedComment #43
nicxvan commentedComment #44
nicxvan commentedComment #45
nicxvan commentedComment #46
nicxvan commentedComment #47
claudiu.cristeaComment #48
claudiu.cristeaComment #49
claudiu.cristeaComment #50
claudiu.cristeaComment #51
nicxvan commentedComment #52
nicxvan commentedComment #53
claudiu.cristeaComment #54
nicxvan commentedComment #55
nicxvan commentedComment #56
nicxvan commentedComment #57
dwwI thought we already had #3487962: Review module .inc files post hook conversion for all the .inc files. Seems a bit duplication of effort here. I guess the problem are the cases (always?) where the .module file is what's including the .inc files, so we can't actually remove the .module until all the .inc are gone, too. Still, not sure where to put issues like #3125013: Refactor update.fetch.inc into a MailHandler.
Comment #58
nicxvan commentedThe issue is that we can address .inc files separately from .module files, but we cannot address .module files without addressing the .inc files.
That means this issue is now a superset so let me close the other one.
Comment #59
nicxvan commentedComment #61
claudiu.cristeaComment #62
nicxvan commentedComment #63
nicxvan commentedComment #64
nicxvan commentedComment #65
nicxvan commentedComment #66
nicxvan commentedComment #67
nicxvan commentedComment #68
claudiu.cristeaComment #69
claudiu.cristeaComment #70
nicxvan commentedComment #71
nicxvan commentedComment #72
nicxvan commentedComment #73
nicxvan commentedComment #74
nicxvan commentedComment #75
nicxvan commentedComment #76
nicxvan commentedComment #77
claudiu.cristeaComment #78
claudiu.cristeaComment #79
claudiu.cristeaComment #80
claudiu.cristeaComment #81
claudiu.cristeaComment #82
claudiu.cristeaComment #83
claudiu.cristeaComment #84
claudiu.cristeaComment #85
claudiu.cristeaComment #86
nicxvan commentedComment #87
claudiu.cristeaComment #88
nicxvan commentedComment #89
nicxvan commentedComment #90
claudiu.cristeaComment #91
claudiu.cristeaComment #92
claudiu.cristeaComment #93
smustgrave commentedComment #94
nicxvan commentedComment #95
claudiu.cristeaComment #96
nicxvan commentedComment #97
nicxvan commentedComment #98
nicxvan commentedComment #99
nicxvan commentedComment #100
nicxvan commentedComment #101
nicxvan commentedComment #102
nicxvan commentedComment #103
nicxvan commentedComment #104
nicxvan commentedComment #105
nicxvan commentedComment #106
nicxvan commentedComment #107
nicxvan commentedComment #108
claudiu.cristeaComment #109
nicxvan commentedComment #110
nicxvan commentedComment #111
nicxvan commentedComment #112
nicxvan commentedComment #113
claudiu.cristeaComment #114
nicxvan commentedComment #115
nicxvan commentedComment #116
nicxvan commentedComment #117
nicxvan commentedComment #118
claudiu.cristeaComment #119
claudiu.cristeaComment #120
claudiu.cristeaComment #121
claudiu.cristeaComment #122
claudiu.cristeaComment #123
nicxvan commentedComment #124
nicxvan commentedComment #125
nicxvan commentedComment #126
nicxvan commentedComment #127
nicxvan commentedComment #128
nicxvan commentedComment #129
nicxvan commentedComment #130
nicxvan commentedComment #131
claudiu.cristeaComment #132
nicxvan commentedComment #133
znerol commentedAdded #3581056: Introduce a OneTimeAuthentication service and deprecate user_pass_rehash.
Comment #134
claudiu.cristeaComment #135
nicxvan commentedComment #136
znerol commentedComment #137
znerol commentedComment #138
znerol commentedAdded #3581569: Remove user_cookie_save() and user_cookie_delete()
Comment #139
nicxvan commentedComment #140
nicxvan commentedComment #141
nicxvan commentedComment #142
nicxvan commentedComment #143
nicxvan commentedQuick stats!
7 issues to be created.
29 merged.
34 issues currently in progress.
4 modules to be removed.
Comment #144
nicxvan commentedComment #145
znerol commentedAdded #3582106: Move user_form_process_password_confirm into UserThemeHooks.
Comment #146
claudiu.cristeaComment #147
claudiu.cristeaComment #148
nicxvan commentedResaving so statuses are correct since a few got in.
Comment #149
claudiu.cristeaComment #150
nicxvan commentedComment #151
nicxvan commentedComment #152
nicxvan commentedComment #153
claudiu.cristeaComment #154
claudiu.cristeaComment #155
nicxvan commentedComment #156
nicxvan commentedUpdate current statuses
Comment #157
claudiu.cristeaComment #158
nicxvan commentedComment #159
nicxvan commentedComment #160
nicxvan commentedComment #161
nicxvan commentedA few things have gotten in, let's bump this for accuracy.
Comment #162
nicxvan commentedComment #163
nicxvan commentedComment #164
nicxvan commented