You are here

public function Display::getLayoutInstance in Layout 8.2

Returns the instantiated layout object.

Throws

\Exception

Overrides BoundDisplayInterface::getLayoutInstance

1 call to Display::getLayoutInstance()
Display::sortBlocks in lib/Drupal/layout/Entity/Display.php
Transform the stored blockConfig into a sorted, region-oriented array.

File

lib/Drupal/layout/Entity/Display.php, line 176
Definition of Drupal\layout\Entity\Display.

Class

Display
Defines the display entity.

Namespace

Drupal\layout\Entity

Code

public function getLayoutInstance() {
  if ($this->layoutInstance === NULL) {
    if (empty($this->layout)) {
      throw new \Exception(sprintf('Display "%id" had no layout plugin attached.', array(
        '%id' => $this
          ->id(),
      )), E_RECOVERABLE_ERROR);
    }
    $this->layoutInstance = \Drupal::service('plugin.manager.layout')
      ->createInstance($this->layout, $this->layoutSettings);

    // @todo add handling for remapping if the layout could not be found
  }
  return $this->layoutInstance;
}