function EnableLayoutBuilderTrait::disableLayoutBuilderFromUi

Same name in other branches
  1. 11.x core/modules/layout_builder/tests/src/Traits/EnableLayoutBuilderTrait.php \Drupal\Tests\layout_builder\Traits\EnableLayoutBuilderTrait::disableLayoutBuilderFromUi()

Disables Layout Builder using the UI.

Parameters

string $bundle: The bundle that Layout Builder is being disabled on.

string $viewMode: The view mode that Layout Builder is being disabled on.

2 calls to EnableLayoutBuilderTrait::disableLayoutBuilderFromUi()
LayoutBuilderOptInTest::testCheckboxLogic in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php
Tests the interaction between the two layout checkboxes.
LayoutDisplayTest::testMultipleViewModes in core/modules/layout_builder/tests/src/Functional/LayoutDisplayTest.php
Tests the interaction between multiple view modes.

File

core/modules/layout_builder/tests/src/Traits/EnableLayoutBuilderTrait.php, line 57

Class

EnableLayoutBuilderTrait
Test trait to enable or disable Layout Builder on an entity view display.

Namespace

Drupal\Tests\layout_builder\Traits

Code

protected function disableLayoutBuilderFromUi(string $bundle, string $viewMode) : void {
    $path = sprintf('admin/structure/types/manage/%s/display/%s', $bundle, $viewMode);
    $page = $this->getSession()
        ->getPage();
    $this->drupalGet($path);
    $page->uncheckField('layout[enabled]');
    $page->pressButton('Save');
    $page->pressButton('Confirm');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.