- $entity_save = function (EntityDisplayWithLayoutInterface $entity) {
- $entity->setLayoutId('layout_onecol')->save();
+ $entity_save = function (EntityDisplayInterface $entity) {
+ if ($entity instanceof EntityDisplayWithLayoutInterface) {
+ $entity->setLayoutId('layout_onecol')->save();
+ }