Chris@0: ensureLayout()->save(); Chris@17: } Chris@0: }; Chris@0: array_map($entity_save, EntityViewDisplay::loadMultiple()); Chris@0: array_map($entity_save, EntityFormDisplay::loadMultiple()); Chris@0: Chris@0: // Invalidate the render cache since all content will now have a layout. Chris@0: Cache::invalidateTags(['rendered']); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Implements hook_uninstall(). Chris@0: */ Chris@0: function field_layout_uninstall() { Chris@0: // Reset each entity display to use the one-column layout to best approximate Chris@0: // the absence of layouts. Chris@17: $entity_save = function (EntityDisplayInterface $entity) { Chris@17: if ($entity instanceof EntityDisplayWithLayoutInterface) { Chris@17: $entity->setLayoutId('layout_onecol')->save(); Chris@17: } Chris@0: }; Chris@0: array_map($entity_save, EntityViewDisplay::loadMultiple()); Chris@0: array_map($entity_save, EntityFormDisplay::loadMultiple()); Chris@0: Chris@0: // Invalidate the render cache since all content will no longer have a layout. Chris@0: Cache::invalidateTags(['rendered']); Chris@0: }