Skip to content

Instantly share code, notes, and snippets.

@ahebrank
Created December 9, 2018 16:59
Show Gist options
  • Select an option

  • Save ahebrank/5c4ecd26fc97b8fc149c0409aba91a35 to your computer and use it in GitHub Desktop.

Select an option

Save ahebrank/5c4ecd26fc97b8fc149c0409aba91a35 to your computer and use it in GitHub Desktop.
diff --git a/core/modules/layout_builder/layout_builder.module b/core/modules/layout_builder/layout_builder.module
index 373f7d8a0f..20ea2ff3d5 100644
--- a/core/modules/layout_builder/layout_builder.module
+++ b/core/modules/layout_builder/layout_builder.module
@@ -106,7 +106,7 @@ function layout_builder_field_config_delete(FieldConfigInterface $field_config)
* @see layout_builder_module_implements_alter()
*/
function layout_builder_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
- if ($display instanceof LayoutEntityDisplayInterface) {
+ if ($entity->isLayoutBuilderEnabled() && ($display instanceof LayoutEntityDisplayInterface)) {
/** @var \Drupal\Core\Entity\EntityFieldManagerInterface $field_manager */
$field_manager = \Drupal::service('entity_field.manager');
$extra_fields = $field_manager->getExtraFields($entity->getEntityTypeId(), $entity->bundle());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment