Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / layout_builder / src / Form / LayoutBuilderEntityViewDisplayForm.php
index fea971bbcd6ddf9071382230dc92a0fdc38e8e67..72edc2f5b78901ca6c9409c4b29785d52ff13fb2 100644 (file)
@@ -7,6 +7,7 @@ use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\field_ui\Form\EntityViewDisplayEditForm;
 use Drupal\layout_builder\Entity\LayoutEntityDisplayInterface;
+use Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage;
 use Drupal\layout_builder\SectionStorageInterface;
 
 /**
@@ -48,8 +49,8 @@ class LayoutBuilderEntityViewDisplayForm extends EntityViewDisplayEditForm {
     $form = parent::form($form, $form_state);
 
     // Remove the Layout Builder field from the list.
-    $form['#fields'] = array_diff($form['#fields'], ['layout_builder__layout']);
-    unset($form['fields']['layout_builder__layout']);
+    $form['#fields'] = array_diff($form['#fields'], [OverridesSectionStorage::FIELD_NAME]);
+    unset($form['fields'][OverridesSectionStorage::FIELD_NAME]);
 
     $is_enabled = $this->entity->isLayoutBuilderEnabled();
     if ($is_enabled) {
@@ -133,7 +134,7 @@ class LayoutBuilderEntityViewDisplayForm extends EntityViewDisplayEditForm {
 
     $entity_type = $this->entityTypeManager->getDefinition($display->getTargetEntityTypeId());
     $query = $this->entityTypeManager->getStorage($display->getTargetEntityTypeId())->getQuery()
-      ->exists('layout_builder__layout');
+      ->exists(OverridesSectionStorage::FIELD_NAME);
     if ($bundle_key = $entity_type->getKey('bundle')) {
       $query->condition($bundle_key, $display->getTargetBundle());
     }