LayoutTempstoreRepositoryInterface.php 1.83 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php

namespace Drupal\layout_builder;

/**
 * Provides an interface for loading layouts from tempstore.
 *
 * @internal
 *   Layout Builder is currently experimental and should only be leveraged by
 *   experimental modules and development releases of contributed modules.
 *   See https://www.drupal.org/core/experimental for more information.
 */
interface LayoutTempstoreRepositoryInterface {

  /**
16
   * Gets the tempstore version of a section storage, if it exists.
17
   *
18 19
   * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
   *   The section storage to check for in tempstore.
20
   *
21 22 23
   * @return \Drupal\layout_builder\SectionStorageInterface
   *   Either the version of this section storage from tempstore, or the passed
   *   section storage if none exists.
24 25
   *
   * @throw \UnexpectedValueException
26
   *   Thrown if a value exists, but is not a section storage.
27
   */
28
  public function get(SectionStorageInterface $section_storage);
29 30

  /**
31
   * Stores this section storage in tempstore.
32
   *
33 34
   * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
   *   The section storage to set in tempstore.
35
   */
36
  public function set(SectionStorageInterface $section_storage);
37

38 39 40 41 42 43 44 45 46 47 48
  /**
   * Checks for the existence of a tempstore version of a section storage.
   *
   * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
   *   The section storage to check for in tempstore.
   *
   * @return bool
   *   TRUE if there is a tempstore version of this section storage.
   */
  public function has(SectionStorageInterface $section_storage);

49
  /**
50
   * Removes the tempstore version of a section storage.
51
   *
52 53
   * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
   *   The section storage to remove from tempstore.
54
   */
55
  public function delete(SectionStorageInterface $section_storage);
56 57

}