Problem/Motivation

See #3566536: [meta] eliminate core .module files

Proposed resolution

According to "Drupal core backend backwards compatibility and internal API policy", section Underscore-prefixed functions and methods

Functions or methods with an underscore prefix (e.g. _some_function()) are considered internal, and may be used to avoid name collisions when backporting protected methods critical or major bug fixes. Extending code should not call these functions or methods directly nor use the underscore prefix for added methods.

Move the following functions, as protected methods, to \Drupal\editor\Hook\EditorHooks and delete them in editor.module, without a replacement.

  • _editor_record_file_usage() -> EditorHooks::recordFileUsage()
  • _editor_delete_file_usage() -> EditorHooks::deleteFileUsage()
  • _editor_get_file_uuids_by_field() -> EditorHooks::getFileUuidsByField()
  • _editor_get_formatted_text_fields() -> EditorHooks::getFormattedTextFields()
  • _editor_parse_file_uuids() -> EditorHooks::parseFileUuids()

Remaining tasks

None.

User interface changes

None.

Introduced terminology

None.

API changes

Underscore prefixed functions from editor.module are deleted.

Data model changes

None.

Issue fork drupal-3568101

Command icon 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

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Issue summary: View changes

Update IS

claudiu.cristea’s picture

Assigned: claudiu.cristea » Unassigned
Status: Active » Needs review

Ready for review.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

The plan seems solid to me. There are no usages of these functions outside of the hook class. The change record looks good. I tested the hooks by adding entities with image files, editing them, deleting them, deleting revisions. Everything still works properly. LGTM.

nicxvan made their first commit to this issue’s fork.

claudiu.cristea’s picture

Status: Reviewed & tested by the community » Needs work

Needs reroll

alexpott’s picture

Discussed with @catch and @longwave and @larowlan - we agreed we should just remove these methods in main and be done. The BC policy should be followed - they are not API - there are a couple of contrib usages but it's not super common.

nicxvan’s picture

We can do that, in order to reduce decision fatigue since there are already .module files with 13 removals we thought we'd be consistent and just deprecate everything.

But if we want to just remove them we can.

We'll have to update a few of the issues if that is the direction.

claudiu.cristea’s picture

Status: Needs work » Needs review

Removed the underscore functions as per #8

dcam’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

All declarations and usages of the underscored files have been deleted from Core. The recent changes look good.

claudiu.cristea’s picture

As it was decided, I've added back the code but for removal in D12

alexpott’s picture

Title: Remove editor.module underscore functions. Move the logic in EditorHooks » Remove editor.module underscore functions in 12.x, deprecate in 11.x. Move the logic in EditorHooks
Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 78087df and pushed to main. Thanks!
Committed 7a2ceed and pushed to 11.x. Thanks!

Note I removed the methods (and fixed the use statements) on the commit to main so there is no need for a follow-up issue to remove the code.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 7a2ceedb on 11.x
    task: #3568101 Remove editor.module underscore functions. Move the logic...

  • alexpott committed 78087dfd on main
    task: #3568101 Remove editor.module underscore functions. Move the logic...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.