layout-builder-extra.php

Test fixture.

File

core/modules/layout_builder/tests/fixtures/update/layout-builder-extra.php

View source
<?php


/**
 * @file
 * Test fixture.
 */
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Enable Layout Builder on an existing entity view display.
$display = $connection->select('config')
    ->fields('config', [
    'data',
])
    ->condition('collection', '')
    ->condition('name', 'core.entity_view_display.node.article.default')
    ->execute()
    ->fetchField();
$display = unserialize($display);
$display['third_party_settings']['layout_builder']['enabled'] = TRUE;
$connection->update('config')
    ->fields([
    'data' => serialize($display),
    'collection' => '',
    'name' => 'core.entity_view_display.node.article.default',
])
    ->condition('collection', '')
    ->condition('name', 'core.entity_view_display.node.article.default')
    ->execute();

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