diff --git a/core/modules/layout_builder/layout_builder.module b/core/modules/layout_builder/layout_builder.module index 5d7c60615c..348b0b44a3 100644 --- a/core/modules/layout_builder/layout_builder.module +++ b/core/modules/layout_builder/layout_builder.module @@ -69,6 +69,14 @@ function layout_builder_form_entity_form_display_edit_form_alter(&$form, FormSta } } +/** + * Implements hook_entity_bundle_create(). + */ +function layout_builder_entity_bundle_create($entity_type_id, $bundle) { + // Clear the list of blocks when a new bundle is created. + \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); +} + /** * Implements hook_field_config_insert(). */ diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutTaxonomyTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutTaxonomyTest.php new file mode 100644 index 0000000000..cd41ce0af7 --- /dev/null +++ b/core/modules/layout_builder/tests/src/Functional/LayoutTaxonomyTest.php @@ -0,0 +1,53 @@ +assertSession(); + + // Prime the block definition cache. + $this->container->get('plugin.manager.block')->getDefinitions(); + + $vocabulary = $this->createVocabulary(); + EntityViewDisplay::create([ + 'targetEntityType' => 'taxonomy_term', + 'bundle' => $vocabulary->id(), + 'mode' => 'default', + 'status' => TRUE, + ]) + ->enableLayoutBuilder() + ->save(); + + $term = $this->createTerm($vocabulary); + $this->drupalGet($term->toUrl()); + $assert_session->statusCodeEquals(200); + $this->assertNotEmpty($this->cssSelect('.layout--onecol')); + $assert_session->pageTextContains($term->getDescription()); + } + +}