$layout->getPluginId(), 'blockInfo' => $this->mapBlocksToLayout($layout), 'id' => $id, ); $entity = entity_create($entity_type, $values); if (!$entity instanceof BoundDisplayInterface) { throw new \Exception(sprintf('Attempted to bind an unbound display but provided an invalid entity type.'), E_RECOVERABLE_ERROR); } return $entity; } }