public function Display::generateUnboundDisplay

Implements BoundDisplayInterface::generateUnboundDisplay().

Throws

\Exception

Overrides BoundDisplayInterface::generateUnboundDisplay

File

drupal/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php, line 152
Definition of Drupal\layout\Plugin\Core\Entity\Display.

Class

Display
Defines the display entity.

Namespace

Drupal\layout\Plugin\Core\Entity

Code

public function generateUnboundDisplay($id, $entity_type = 'unbound_display') {
  $block_info = $this
    ->getAllBlockInfo();
  foreach ($block_info as &$info) {
    unset($info['region']);
  }
  $values = array(
    'blockInfo' => $block_info,
    'id' => $id,
  );
  $entity = entity_create($entity_type, $values);
  if (!$entity instanceof UnboundDisplayInterface) {
    throw new \Exception(sprintf('Attempted to create an unbound display using an invalid entity type.'), E_RECOVERABLE_ERROR);
  }
  return $entity;
}