diff --git a/core/modules/layout_builder/config/install/layout_builder.settings.yml b/core/modules/layout_builder/config/install/layout_builder.settings.yml deleted file mode 100644 index 43521763c7b16707186c8ac880f7783bce13d04b..0000000000000000000000000000000000000000 --- a/core/modules/layout_builder/config/install/layout_builder.settings.yml +++ /dev/null @@ -1 +0,0 @@ -expose_all_field_blocks: false diff --git a/core/modules/layout_builder/config/schema/layout_builder.schema.yml b/core/modules/layout_builder/config/schema/layout_builder.schema.yml index 9240ee8cb55d97fc342eb6fd32d7e188329e8823..0bab48dfbb5e6492fc2233d43a8e8e1e4c8626c5 100644 --- a/core/modules/layout_builder/config/schema/layout_builder.schema.yml +++ b/core/modules/layout_builder/config/schema/layout_builder.schema.yml @@ -89,11 +89,3 @@ layout_plugin.settings.layout_twocol_section: layout_plugin.settings.layout_threecol_section: type: layout_builder_multi_width - -layout_builder.settings: - type: config_object - label: 'Layout builder settings' - mapping: - expose_all_field_blocks: - type: boolean - label: 'Expose all field blocks' diff --git a/core/modules/layout_builder/layout_builder.info.yml b/core/modules/layout_builder/layout_builder.info.yml index f54c8df3639f411a3687dcabe6a040f1522b5d03..0a6e43ea3b280c099666c2f066a3be37165b7b9c 100644 --- a/core/modules/layout_builder/layout_builder.info.yml +++ b/core/modules/layout_builder/layout_builder.info.yml @@ -1,7 +1,6 @@ name: 'Layout Builder' type: module description: 'Allows users to add and arrange blocks and content fields directly on the content.' -configure: layout_builder.settings package: Core version: VERSION dependencies: diff --git a/core/modules/layout_builder/layout_builder.links.menu.yml b/core/modules/layout_builder/layout_builder.links.menu.yml deleted file mode 100644 index 018db609688ee95affafd6e81772191174e7a641..0000000000000000000000000000000000000000 --- a/core/modules/layout_builder/layout_builder.links.menu.yml +++ /dev/null @@ -1,5 +0,0 @@ -layout_builder.settings: - title: 'Layout Builder' - parent: system.admin_config_content - description: 'Configure Layout Builder settings.' - route_name: layout_builder.settings diff --git a/core/modules/layout_builder/layout_builder.permissions.yml b/core/modules/layout_builder/layout_builder.permissions.yml index 562524dd002eda21737ae451f59fee3a1ac3473f..5799cb652b84ab4cf79b54207b9598256ae5b738 100644 --- a/core/modules/layout_builder/layout_builder.permissions.yml +++ b/core/modules/layout_builder/layout_builder.permissions.yml @@ -1,6 +1,3 @@ -administer layout builder: - title: 'Administer layout builder' - restrict access: true configure any layout: title: 'Configure any layout' restrict access: true diff --git a/core/modules/layout_builder/layout_builder.post_update.php b/core/modules/layout_builder/layout_builder.post_update.php index 87a5de85f38f2120fe67ddff8bd155087644fa79..e9d38776b8eda3ec1cad0c8829992eee4eab5bad 100644 --- a/core/modules/layout_builder/layout_builder.post_update.php +++ b/core/modules/layout_builder/layout_builder.post_update.php @@ -71,10 +71,8 @@ function layout_builder_post_update_timestamp_formatter(array &$sandbox = NULL): } /** - * Configure the default expose all fields setting. + * Enable the expose all fields feature flag module. */ -function layout_builder_post_update_default_expose_field_block_setting(): void { - \Drupal::configFactory()->getEditable('layout_builder.settings') - ->set('expose_all_field_blocks', TRUE) - ->save(TRUE); +function layout_builder_post_update_enable_expose_field_block_feature_flag(): void { + \Drupal::service('module_installer')->install(['layout_builder_expose_all_field_blocks']); } diff --git a/core/modules/layout_builder/layout_builder.routing.yml b/core/modules/layout_builder/layout_builder.routing.yml index 88b3739c3f1c6d76b5bafd74f2340fd32ef7e2ef..fa72dcec931f8cec5fb139e35addba1618e4d9ff 100644 --- a/core/modules/layout_builder/layout_builder.routing.yml +++ b/core/modules/layout_builder/layout_builder.routing.yml @@ -1,11 +1,3 @@ -layout_builder.settings: - path: '/admin/config/content/layout-builder' - defaults: - _form: '\Drupal\layout_builder\Form\LayoutBuilderSettingsForm' - _title: 'Layout Builder' - requirements: - _permission: 'administer layout builder' - layout_builder.choose_section: path: '/layout_builder/choose/section/{section_storage_type}/{section_storage}/{delta}' defaults: diff --git a/core/modules/layout_builder/layout_builder.services.yml b/core/modules/layout_builder/layout_builder.services.yml index 9db2a0919aba515be6e6ecc110ea9053db902dfc..65c93652209b5e6f814d8756fb35264428a8539f 100644 --- a/core/modules/layout_builder/layout_builder.services.yml +++ b/core/modules/layout_builder/layout_builder.services.yml @@ -68,6 +68,3 @@ services: layout_builder.element.prepare_layout: class: Drupal\layout_builder\EventSubscriber\PrepareLayout arguments: ['@layout_builder.tempstore_repository', '@messenger'] - layout_builder.config_subscriber: - class: Drupal\layout_builder\EventSubscriber\LayoutBuilderConfigSubscriber - arguments: ['@plugin.manager.block'] diff --git a/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/layout_builder_expose_all_field_blocks.info.yml b/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/layout_builder_expose_all_field_blocks.info.yml new file mode 100644 index 0000000000000000000000000000000000000000..303a98990d706438185b712a84bbf83573a38421 --- /dev/null +++ b/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/layout_builder_expose_all_field_blocks.info.yml @@ -0,0 +1,9 @@ +name: 'Layout Builder Expose All Field Blocks' +type: module +description: 'When enabled, this module exposes all fields for all entity view displays. When disabled, only entity type bundles that have layout builder enabled will have their fields exposed. Enabling this module could significantly decrease performance on sites with a large number of entity types and bundles.' +package: Core +version: VERSION +dependencies: + - drupal:layout_builder +lifecycle: deprecated +lifecycle_link: "https://www.drupal.org/node/3223395#s-layout-builder-expose-all-field-blocks" diff --git a/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/layout_builder_expose_all_field_blocks.module b/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/layout_builder_expose_all_field_blocks.module new file mode 100644 index 0000000000000000000000000000000000000000..8da8050c57ef200b736452acb485126ec0220f0e --- /dev/null +++ b/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/layout_builder_expose_all_field_blocks.module @@ -0,0 +1,25 @@ +<?php + +/** + * @file + * Module implementation file. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function layout_builder_expose_all_field_blocks_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + case 'help.page.layout_builder_expose_all_field_blocks': + $output = '<h2>' . t('About') . '</h2>'; + $output .= '<p>' . t('The Layout Builder Expose All Field Blocks module is a Feature Flag module which, when enabled, exposes all fields on all bundles as field blocks for use in Layout Builder.') . '</p>'; + $output .= '<p>' . t('Leaving this module enabled can significantly affect the performance of medium to large sites due to the number of Field Block plugins that will be created. It is recommended to turn it off if possible.') . '</p>'; + $output .= '<p>' . t('While it is recommended to turn this module off, note that this may remove blocks that are already being used in existing site configurations.') . '</p>'; + $output .= '<p>' . t("For example, if you have Layout Builder enabled on a Node bundle (Content type), and that bundle's display is using field blocks from the User entity (e.g the Author's name), but Layout Builder is not enabled for the User bundle, then that field block would no longer exist after disabling this module.") . '</p>'; + $output .= '<p>' . t('For more information, see the <a href=":href">online documentation for the Layout Builder Expose All Field Blocks module</a>.', [':href' => 'https://www.drupal.org/node/3223395#s-layout-builder-expose-all-field-blocks']) . '</p>'; + return $output; + } + return NULL; +} diff --git a/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional/GenericTest.php b/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional/GenericTest.php new file mode 100644 index 0000000000000000000000000000000000000000..60668ee9da77e9555e14df45476addb87d70c79a --- /dev/null +++ b/core/modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional/GenericTest.php @@ -0,0 +1,15 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\Tests\layout_builder_expose_all_field_blocks\Functional; + +use Drupal\Tests\system\Functional\Module\GenericModuleTestBase; + +/** + * Generic module test for layout_builder_expose_all_field_blocks. + * + * @group layout_builder_expose_all_field_blocks + * @group legacy + */ +class GenericTest extends GenericModuleTestBase {} diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php index 2b390f5231dbf2b52184dc4683569c533efd796b..6e058878bfae291b07216181098b0dc075f6fb48 100644 --- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php +++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php @@ -164,7 +164,7 @@ public function preSave(EntityStorageInterface $storage) { */ public function save(): int { $return = parent::save(); - if (!\Drupal::config('layout_builder.settings')->get('expose_all_field_blocks')) { + if (!\Drupal::moduleHandler()->moduleExists('layout_builder_expose_all_field_blocks')) { // Invalidate the block cache in order to regenerate field block // definitions. \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); diff --git a/core/modules/layout_builder/src/EventSubscriber/LayoutBuilderConfigSubscriber.php b/core/modules/layout_builder/src/EventSubscriber/LayoutBuilderConfigSubscriber.php deleted file mode 100644 index cb681724664ef316e4c3e8c72da6983f1e3ffe7f..0000000000000000000000000000000000000000 --- a/core/modules/layout_builder/src/EventSubscriber/LayoutBuilderConfigSubscriber.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\layout_builder\EventSubscriber; - -use Drupal\Core\Block\BlockManagerInterface; -use Drupal\Core\Config\ConfigCrudEvent; -use Drupal\Core\Config\ConfigEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Layout Builder Config subscriber. - */ -final class LayoutBuilderConfigSubscriber implements EventSubscriberInterface { - - /** - * Constructs a LayoutBuilderConfigSubscriber. - */ - public function __construct( - protected BlockManagerInterface $blockManager, - ) { - } - - /** - * Clears the block plugin cache when expose_all_field_blocks changes. - * - * @param \Drupal\Core\Config\ConfigCrudEvent $event - * The configuration event. - */ - public function onConfigSave(ConfigCrudEvent $event): void { - $saved_config = $event->getConfig(); - if ($saved_config->getName() == 'layout_builder.settings' && $event->isChanged('expose_all_field_blocks')) { - $this->blockManager->clearCachedDefinitions(); - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents(): array { - $events[ConfigEvents::SAVE][] = ['onConfigSave']; - return $events; - } - -} diff --git a/core/modules/layout_builder/src/Form/LayoutBuilderSettingsForm.php b/core/modules/layout_builder/src/Form/LayoutBuilderSettingsForm.php deleted file mode 100644 index 6a96b39fb942b486d44a6bbe6099495352c15c41..0000000000000000000000000000000000000000 --- a/core/modules/layout_builder/src/Form/LayoutBuilderSettingsForm.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\layout_builder\Form; - -use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Form\RedundantEditableConfigNamesTrait; - -/** - * Configure layout builder settings for this site. - * - * @internal - */ -final class LayoutBuilderSettingsForm extends ConfigFormBase { - - use RedundantEditableConfigNamesTrait; - - /** - * {@inheritdoc} - */ - public function getFormId(): string { - return 'layout_builder_settings'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state): array { - $form['expose_all_field_blocks'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Expose all fields as blocks to layout builder'), - '#description' => $this->t('When enabled, this setting exposes all fields for all entity view displays.<br/> When disabled, only entity type bundles that have layout builder enabled will have their fields exposed.<br/> Enabling this setting could <strong>significantly decrease performance</strong> on sites with a large number of entity types and bundles.'), - '#config_target' => 'layout_builder.settings:expose_all_field_blocks', - ]; - return parent::buildForm($form, $form_state); - } - -} diff --git a/core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php b/core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php index 969d1ec8edc68f136e7302432825e2fe6ee4213f..087ef13d85e5215bb71c77de423795210e2e2833 100644 --- a/core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php +++ b/core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php @@ -4,11 +4,11 @@ use Drupal\Component\Plugin\Derivative\DeriverBase; use Drupal\Component\Plugin\PluginBase; -use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\FieldableEntityInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\Context\EntityContextDefinition; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; @@ -64,15 +64,15 @@ class ExtraFieldBlockDeriver extends DeriverBase implements ContainerDeriverInte * The entity type bundle info. * @param \Drupal\Core\Entity\EntityTypeRepositoryInterface $entity_type_repository * The entity type repository. - * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory - * The config factory. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler + * The module handler. */ public function __construct( EntityFieldManagerInterface $entity_field_manager, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeRepositoryInterface $entity_type_repository, - protected ConfigFactoryInterface $configFactory, + protected ModuleHandlerInterface $moduleHandler, ) { $this->entityFieldManager = $entity_field_manager; $this->entityTypeManager = $entity_type_manager; @@ -89,7 +89,7 @@ public static function create(ContainerInterface $container, $base_plugin_id) { $container->get('entity_type.manager'), $container->get('entity_type.bundle.info'), $container->get('entity_type.repository'), - $container->get('config.factory') + $container->get('module_handler') ); } @@ -99,7 +99,7 @@ public static function create(ContainerInterface $container, $base_plugin_id) { public function getDerivativeDefinitions($base_plugin_definition) { $entity_type_labels = $this->entityTypeRepository->getEntityTypeLabels(); $enabled_bundle_ids = $this->bundleIdsWithLayoutBuilderDisplays(); - $expose_all_fields = $this->configFactory->get('layout_builder.settings')->get('expose_all_field_blocks'); + $expose_all_fields = $this->moduleHandler->moduleExists('layout_builder_expose_all_field_blocks'); foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { // Only process fieldable entity types. if (!$entity_type->entityClassImplements(FieldableEntityInterface::class)) { diff --git a/core/modules/layout_builder/src/Plugin/Derivative/FieldBlockDeriver.php b/core/modules/layout_builder/src/Plugin/Derivative/FieldBlockDeriver.php index 44409b27b2e4256484dc6a8a04e625b3eaa8ce49..e01a03002012fab2e967ca5948d38f524032c429 100644 --- a/core/modules/layout_builder/src/Plugin/Derivative/FieldBlockDeriver.php +++ b/core/modules/layout_builder/src/Plugin/Derivative/FieldBlockDeriver.php @@ -4,10 +4,10 @@ use Drupal\Component\Plugin\Derivative\DeriverBase; use Drupal\Component\Plugin\PluginBase; -use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\Entity\ConfigEntityStorageInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeRepositoryInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldConfigInterface; use Drupal\Core\Field\FieldTypePluginManagerInterface; use Drupal\Core\Field\FormatterPluginManager; @@ -70,8 +70,8 @@ class FieldBlockDeriver extends DeriverBase implements ContainerDeriverInterface * The formatter manager. * @param \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $entityViewDisplayStorage * The entity view display storage. - * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory - * The config factory. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler + * The module handler. */ public function __construct( EntityTypeRepositoryInterface $entity_type_repository, @@ -79,7 +79,7 @@ public function __construct( FieldTypePluginManagerInterface $field_type_manager, FormatterPluginManager $formatter_manager, protected ConfigEntityStorageInterface $entityViewDisplayStorage, - protected ConfigFactoryInterface $configFactory, + protected ModuleHandlerInterface $moduleHandler, ) { $this->entityTypeRepository = $entity_type_repository; $this->entityFieldManager = $entity_field_manager; @@ -97,7 +97,7 @@ public static function create(ContainerInterface $container, $base_plugin_id) { $container->get('plugin.manager.field.field_type'), $container->get('plugin.manager.field.formatter'), $container->get('entity_type.manager')->getStorage('entity_view_display'), - $container->get('config.factory') + $container->get('module_handler') ); } @@ -170,7 +170,7 @@ protected function getFieldMap(): array { // If all fields are exposed as field blocks, just return the field map // without any further processing. - if ($this->configFactory->get('layout_builder.settings')->get('expose_all_field_blocks')) { + if ($this->moduleHandler->moduleExists('layout_builder_expose_all_field_blocks')) { return $field_map; } diff --git a/core/modules/layout_builder/tests/src/Functional/SettingsFormTest.php b/core/modules/layout_builder/tests/src/Functional/SettingsFormTest.php deleted file mode 100644 index 884d63ede33970cc03606ff59aa02aaba1ec3476..0000000000000000000000000000000000000000 --- a/core/modules/layout_builder/tests/src/Functional/SettingsFormTest.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\layout_builder\Functional; - -use Drupal\Core\Url; -use Drupal\Tests\BrowserTestBase; - -/** - * Tests the Layout Builder settings form. - * - * @coversDefaultClass \Drupal\layout_builder\Form\LayoutBuilderSettingsForm - * @group layout_builder - */ -class SettingsFormTest extends BrowserTestBase { - - /** - * {@inheritdoc} - */ - protected static $modules = ['layout_builder']; - - /** - * {@inheritdoc} - */ - protected $defaultTheme = 'stark'; - - /** - * Tests the Layout Builder settings form. - */ - public function testSettingsForm(): void { - $this->drupalLogin($this->drupalCreateUser([ - 'access administration pages', - 'administer layout builder', - ])); - - $this->drupalGet(Url::fromRoute('layout_builder.settings')); - $this->assertSession()->statusCodeEquals(200); - $this->submitForm([ - 'expose_all_field_blocks' => 1, - ], 'Save configuration'); - - $this->assertSession()->pageTextContains('The configuration options have been saved'); - $this->assertSession()->checkboxChecked('expose_all_field_blocks'); - $this->submitForm([ - 'expose_all_field_blocks' => 0, - ], 'Save configuration'); - $this->assertSession()->pageTextContains('The configuration options have been saved'); - $this->assertSession()->checkboxNotChecked('expose_all_field_blocks'); - } - -} diff --git a/core/modules/layout_builder/tests/src/Functional/Update/LayoutBuilderSettingsUpdateTest.php b/core/modules/layout_builder/tests/src/Functional/Update/LayoutBuilderSettingsUpdateTest.php deleted file mode 100644 index 33c4fae7fb2c42040eedc90d89da20d0d161fbd3..0000000000000000000000000000000000000000 --- a/core/modules/layout_builder/tests/src/Functional/Update/LayoutBuilderSettingsUpdateTest.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\layout_builder\Functional\Update; - -use Drupal\FunctionalTests\Update\UpdatePathTestBase; - -/** - * Tests creation of layout_builder settings. - * - * @see layout_builder_post_update_default_expose_field_block_setting() - * - * @group Update - */ -class LayoutBuilderSettingsUpdateTest extends UpdatePathTestBase { - - /** - * {@inheritdoc} - */ - protected function setDatabaseDumpFiles() { - $this->databaseDumpFiles = [ - __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-9.4.0.bare.standard.php.gz', - __DIR__ . '/../../../fixtures/update/layout-builder.php', - ]; - } - - /** - * Tests layout_builder_post_update_default_expose_field_block_setting(). - */ - public function testLayoutBuilderPostUpdateExposeFieldBlockSetting(): void { - // Ensure config is not present. - $config = $this->config('layout_builder.settings'); - $this->assertTrue($config->isNew()); - - $this->runUpdates(); - - // Ensure config is present and setting is enabled. - $updated_config = $this->config('layout_builder.settings'); - $this->assertFalse($updated_config->isNew()); - $this->assertTrue($updated_config->get('expose_all_field_blocks')); - } - -} diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php index fa2a79d2f7dabc6416c961b9e80e45abd9b7a5ae..0921ce8384b4aefdea1f7d06434f2a71f99835fd 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php @@ -12,6 +12,7 @@ * Tests the JavaScript functionality of the block add filter. * * @group layout_builder + * @group legacy */ class BlockFilterTest extends WebDriverTestBase { @@ -23,6 +24,7 @@ class BlockFilterTest extends WebDriverTestBase { 'node', 'datetime', 'layout_builder', + 'layout_builder_expose_all_field_blocks', 'user', ]; @@ -37,12 +39,6 @@ class BlockFilterTest extends WebDriverTestBase { protected function setUp(): void { parent::setUp(); - // This test makes assertions on lists of blocks, this includes a derived - // block from the user entity. - \Drupal::configFactory()->getEditable('layout_builder.settings') - ->set('expose_all_field_blocks', TRUE) - ->save(); - $this->drupalLogin($this->drupalCreateUser([ 'configure any layout', ])); diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php index b3847ab67008bc4a1a7e3e4d19d6490e81958341..d4a574d4b334cb696f2c374ed9484506cb4f3906 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php @@ -14,6 +14,7 @@ * @coversDefaultClass \Drupal\layout_builder\Plugin\Block\FieldBlock * * @group field + * @group legacy */ class FieldBlockTest extends WebDriverTestBase { @@ -27,6 +28,7 @@ class FieldBlockTest extends WebDriverTestBase { 'user', // See \Drupal\layout_builder_fieldblock_test\Plugin\Block\FieldBlock. 'layout_builder_fieldblock_test', + 'layout_builder_expose_all_field_blocks', ]; /** @@ -40,9 +42,6 @@ class FieldBlockTest extends WebDriverTestBase { protected function setUp(): void { parent::setUp(); - \Drupal::configFactory()->getEditable('layout_builder.settings') - ->set('expose_all_field_blocks', TRUE) - ->save(); $field_storage = FieldStorageConfig::create([ 'field_name' => 'field_date', 'entity_type' => 'user', diff --git a/core/modules/layout_builder/tests/src/Kernel/FieldBlockDeriverTest.php b/core/modules/layout_builder/tests/src/Kernel/FieldBlockDeriverTest.php index 21f68e01a6c8335823c0f5710cd4319218e63469..14b5cf4958f12201a0d17ea2aaa4e1053f853fc9 100644 --- a/core/modules/layout_builder/tests/src/Kernel/FieldBlockDeriverTest.php +++ b/core/modules/layout_builder/tests/src/Kernel/FieldBlockDeriverTest.php @@ -11,6 +11,7 @@ * Tests field block plugin derivatives. * * @group layout_builder + * @group legacy */ class FieldBlockDeriverTest extends EntityKernelTestBase { @@ -57,9 +58,7 @@ public function testFieldBlockDerivers(): void { $this->assertNotContains('extra_field_block:user:user:member_for', $plugins); // Exposing all field blocks adds them for the user entity type. - \Drupal::configFactory()->getEditable('layout_builder.settings') - ->set('expose_all_field_blocks', TRUE) - ->save(); + \Drupal::service('module_installer')->install(['layout_builder_expose_all_field_blocks']); $plugins = $this->getBlockPluginIds(); $this->assertContains('field_block:user:user:name', $plugins); $this->assertContains('extra_field_block:user:user:member_for', $plugins);