ensureLayout()->save(); }; array_map($entity_save, EntityViewDisplay::loadMultiple()); array_map($entity_save, EntityFormDisplay::loadMultiple()); // Invalidate the render cache since all content will now have a layout. Cache::invalidateTags(['rendered']); } /** * Implements hook_uninstall(). */ 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(); }; array_map($entity_save, EntityViewDisplay::loadMultiple()); array_map($entity_save, EntityFormDisplay::loadMultiple()); // Invalidate the render cache since all content will no longer have a layout. Cache::invalidateTags(['rendered']); }