You are here

public function LayoutParagraphsLayoutTempstoreRepository::get in Layout Paragraphs 2.0.x

Get a layout paragraphs layout from the tempstore.

File

src/LayoutParagraphsLayoutTempstoreRepository.php, line 32

Class

LayoutParagraphsLayoutTempstoreRepository
Layout Paragraphs Layout Tempstore Repository class definition.

Namespace

Drupal\layout_paragraphs

Code

public function get(LayoutParagraphsLayout $layout_paragraphs_layout) {
  $key = $this
    ->getStorageKey($layout_paragraphs_layout);
  $tempstore_layout = $this
    ->getWithStorageKey($key);

  // Editor isn't in tempstore yet, so add it.
  if (empty($tempstore_layout)) {
    $tempstore_layout = $this
      ->set($layout_paragraphs_layout);
  }
  return $tempstore_layout;
}