You are here

public function PageManagerLayoutBuilderStorage::load in Page Manager 8.4

File

src/Plugin/LayoutBuilderStorage/PageManagerLayoutBuilderStorage.php, line 90

Class

PageManagerLayoutBuilderStorage
A Page Manager storage service that stores Layout Builder displays.

Namespace

Drupal\page_manager\Plugin\LayoutBuilderStorage

Code

public function load($id) {
  if ($page_variant = $this
    ->loadPageVariant($id)) {
    $lb_display = $page_variant
      ->getVariantPlugin();

    // If this page variant doesn't have a Panels display on it, then we treat
    // it the same as if there was no such page variant.
    if (!$lb_display instanceof LayoutBuilderDisplayVariant) {
      return NULL;
    }

    // Pass down the contexts because the display has no other way to get them
    // from the variant.
    $lb_display
      ->setContexts($page_variant
      ->getContexts());
    return $lb_display;
  }
}