Problem/Motivation

Field Layout is being deprecated.

Field layout settings are used in layout_builder.install

  foreach ($displays as $display) {
    // Create the first section from any existing Field Layout settings.
    $field_layout = $display->getThirdPartySettings('field_layout');
    if (isset($field_layout['id'])) {
      $field_layout += ['settings' => []];
      $display
        ->enableLayoutBuilder()
        ->appendSection(new Section($field_layout['id'], $field_layout['settings']))
        ->save();
      $display_changed = TRUE;
    }
  }

Additionally, there is a kernel test (LayoutBuilderFieldLayoutCompatibilityTest) that only exists to validate this integration, which is now obsolete and should be removed.

Steps to reproduce

  • Enable Layout Builder with the field_layout module enabled.
  • Notice that layout_builder.install still attempts to migrate field_layout settings.
  • Run the kernel test LayoutBuilderFieldLayoutCompatibilityTest, it is only verifying deprecated behavior.

Proposed resolution

Copy usage and test coverage from layout builder into field_layout

Remaining tasks

  • Final review

User interface changes

None.

Introduced terminology

None.

API changes

Removes field_layout-related initialization from Layout Builder.

Data model changes

None.

Release notes snippet

NA

Issue fork drupal-3541507

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

quietone created an issue. See original summary.

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

ajinkya45’s picture

Status: Active » Needs review
deepakkm’s picture

Status: Needs review » Needs work

I think the test also needs to worked upon, hence moving in progress.

ajinkya45’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Summary appears incomplete

ajinkya45’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Still seems to be the same issue summary.

Talking about the ticket btw

ajinkya45’s picture

Issue summary: View changes
ajinkya45’s picture

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Needs work

The changes look OK to me with the exception of one thing. I left a suggestion on the MR.

ajinkya45’s picture

Status: Needs work » Needs review
dcam’s picture

I don't know the internals of Layout Builder well enough to understand what this install function does. So I'm not comfortable OKing the changes. But I did notice that the old code saved the display entity. The new code does not. That seems like an oversight. If the tests pass despite that, then it probably indicates a lack of test coverage.

ajinkya45’s picture

The failing tests (LayoutBuilderOptInTest) are asserting that Layout Builder should not be enabled by default, but my patch enables it on all displays. Can we confirm whether the intent is to move to Layout Builder being always enabled by default, or should we only be enabling it when migrating from field_layout?

smustgrave’s picture

Status: Needs review » Needs work

Shouldn't the test and install be moved to field_layout. This seems to be losing test coverage and functionality moving to contrib

smustgrave’s picture

Issue summary: View changes
quietone’s picture

Title: Remove field_layout from layout_builder » Move field_layout test integration from layout_builder to field_layout
quietone’s picture

LayoutBuilderFieldLayoutCompatibilityTest was moved to field_layout in #3541499: Move field_layout tests to field_layout module.

larowlan’s picture

I think what we want here is a `hook_modules_installed` in field_layout module that does what layout_builder.install is doing if the module being installed is layout_builder. I.e flip the responsibility from LB to field layout

quietone’s picture

Status: Needs work » Needs review

@larowlan, thanks that is just what I needed.

@ajinkya45, Sorry for not making the issue summary explicit. This isn't a simple removal. We need to retain test coverage but move all the code dependent on field_layout to field_layout itself. That way we can remove the entire field_layout module from core safely.

Restarted this by reverted the previous two 'removal' only commits. The test was moved to field_layout in a sibling issue, that just leaves dealing with function layout_builder_install():. For that I followed the advice in #20 but as an OO hook.

quietone’s picture

Title: Move field_layout test integration from layout_builder to field_layout » Move field_layout display updates from layout_builder to field_layout
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Seems like a good move.

  • catch committed 633128ec on 11.3.x
    Issue #3541507 by quietone, ajinkya45, smustgrave, dcam, larowlan: Move...

  • catch committed 6e083db1 on 11.x
    Issue #3541507 by quietone, ajinkya45, smustgrave, dcam, larowlan: Move...
catch’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 11.3.x, thanks!

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.

Status: Fixed » Closed (fixed)

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