Problem/Motivation

There is a class with a bag of public static methods not clearly related and not covered by any interfaces: https://git.drupalcode.org/project/display_builder/-/blob/1.0.x/src/Disp...

  • ::isDisplayBuilderEntityType() belongs to display_builder_entity_view module
  • ::findAndReplaceInArray(): used only in PreviewPanel, can be moved there as a protected method
  • ::findArrayReplaceSource(): used only in PageLayoutPageVariant, can be moved there as a protected method
  • ::getFixtureDataFromExtension(): used only in ViewDisplay, can be moved there as a protected method
  • ::formatLog(): used nowhere, can be removed
  • ::formatTime(): used 3 times. Could be an extension of the date formatter service, calling ::formatTimeDiffSince() from a brand new method

Proposed resolution

Move stuff, delete stuff.

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

pdureau created an issue. See original summary.

mogtofu33’s picture

  • findAndReplaceInArray() is gone.
  • formatLog() has no caller left.
  • findArrayReplaceSource() has two callers now, PageLayoutPageVariant and PageRegionSourceBase, both in display_builder_page_layout. Removing it needs the title and main content swap replaced first.
  • getFixtureDataFromExtension() is used by ViewDisplay and by the dev tools.
  • formatTime() has four callers in four modules.
  • isDisplayBuilderEntityType() has three callers, all in display_builder_entity_view.
  • Two statics arrived in beta7, both used across modules: markSampleEntity() and previewedInstanceId().

Proposal, in two steps:

  1. Before RC1: mark the class @internal, as #3624396: Plan: Harden InstanceInterface, IslandInterface and DisplayBuildableInterface as public API before RC1 does for everything in src/ that is not API, and delete formatLog(). Small, no behavior change.
  2. Then move each method to its module or its service, one at a time. Once the class is internal, none of these moves is a BC break, so they can land after RC1.

mogtofu33’s picture

Status: Active » Needs work

Marked internal and small cleanup merged, now full removal can be done in parts after RC (or before if possible).

  • mogtofu33 committed c20e88ef on 1.0.x
    task: #3606952 Mark DisplayBuilderHelpers internal and remove the unused...
pdureau’s picture

now full removal can be done in parts after RC (or before if possible).

Ok, i remove the display_builder-1.0.0-beta tag