You are here

layout-builder-extra.php in Drupal 8

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();