Problem/Motivation

As pointed out in #3091309-37: Broken context-aware block plugins throw an unexpected exception, there are 3+ ways to enable Layout Builder, often used within the same test class.

Proposed resolution

If the UI itself is what is being tested, use code like

    $this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default');
    $page->checkField('layout[enabled]');
    $page->pressButton('Save');
    $page->checkField('layout[allow_custom]');
    $page->pressButton('Save');

Otherwise, use code like

    LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')
      ->enableLayoutBuilder()
      ->setOverridable()
      ->save()

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3158916

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

tim.plunkett created an issue. See original summary.

singhrt’s picture

Assigned: Unassigned » singhrt
singhrt’s picture

Assigned: singhrt » Unassigned

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

danielveza’s picture

Status: Active » Needs review

I've been working on this one, tests are now green. I've done the following:

  • Introduced a new test trait for enabling LB in tests
  • Updated tests to enable LB via the API where possible.

I tried to keep the scope for this one small, we should open a follow up for converting the rest of the LB tests to use the new trait.

mstrelan’s picture

Status: Needs review » Needs work

A few nits and one suggested parameter type change.

danielveza’s picture

Status: Needs work » Needs review

Agreed with all the feedback. Pushed up a new commit to address them.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Refactoring appears good to me. New functions have typehint returns, tests all green so nothing appeared to break.

  • catch committed 3400d1e6 on 10.3.x
    Issue #3158916 by DanielVeza, tim.plunkett, mstrelan: Enable Layout...

  • catch committed bb733ec6 on 11.x
    Issue #3158916 by DanielVeza, tim.plunkett, mstrelan: Enable Layout...
catch’s picture

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

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

Status: Fixed » Closed (fixed)

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