X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffield_layout%2Ffield_layout.install;fp=web%2Fcore%2Fmodules%2Ffield_layout%2Ffield_layout.install;h=88882d39289dfd17cf266ac155f9b8fa2e5e4fcf;hp=5956bf1095412e89993b8381d7fd96fb0e8e7094;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/field_layout/field_layout.install b/web/core/modules/field_layout/field_layout.install index 5956bf109..88882d392 100644 --- a/web/core/modules/field_layout/field_layout.install +++ b/web/core/modules/field_layout/field_layout.install @@ -6,6 +6,7 @@ */ use Drupal\Core\Cache\Cache; +use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\field_layout\Display\EntityDisplayWithLayoutInterface; @@ -15,8 +16,10 @@ use Drupal\field_layout\Display\EntityDisplayWithLayoutInterface; */ function field_layout_install() { // Ensure each entity display has a layout. - $entity_save = function (EntityDisplayWithLayoutInterface $entity) { - $entity->ensureLayout()->save(); + $entity_save = function (EntityDisplayInterface $entity) { + if ($entity instanceof EntityDisplayWithLayoutInterface) { + $entity->ensureLayout()->save(); + } }; array_map($entity_save, EntityViewDisplay::loadMultiple()); array_map($entity_save, EntityFormDisplay::loadMultiple()); @@ -31,8 +34,10 @@ function field_layout_install() { function field_layout_uninstall() { // Reset each entity display to use the one-column layout to best approximate // the absence of layouts. - $entity_save = function (EntityDisplayWithLayoutInterface $entity) { - $entity->setLayoutId('layout_onecol')->save(); + $entity_save = function (EntityDisplayInterface $entity) { + if ($entity instanceof EntityDisplayWithLayoutInterface) { + $entity->setLayoutId('layout_onecol')->save(); + } }; array_map($entity_save, EntityViewDisplay::loadMultiple()); array_map($entity_save, EntityFormDisplay::loadMultiple());