1<?php
2
3namespace Drupal\field_layout\Display;
4
5use Drupal\Core\Entity\Display\EntityDisplayInterface;
6use Drupal\Core\Layout\LayoutInterface;
7
8/**
9 * Provides a common interface for entity displays that have layout.
10 */
11interface EntityDisplayWithLayoutInterface extends EntityDisplayInterface {
12
13  /**
14   * Gets the default region.
15   *
16   * @return string
17   *   The default region for this display.
18   */
19  public function getDefaultRegion();
20
21  /**
22   * Gets the layout plugin ID for this display.
23   *
24   * @return string
25   *   The layout plugin ID.
26   */
27  public function getLayoutId();
28
29  /**
30   * Gets the layout plugin settings for this display.
31   *
32   * @return mixed[]
33   *   The layout plugin settings.
34   */
35  public function getLayoutSettings();
36
37  /**
38   * Sets the layout plugin ID for this display.
39   *
40   * @param string|null $layout_id
41   *   Either a valid layout plugin ID, or NULL to remove the layout setting.
42   * @param array $layout_settings
43   *   (optional) An array of settings for this layout.
44   *
45   * @return $this
46   */
47  public function setLayoutId($layout_id, array $layout_settings = []);
48
49  /**
50   * Sets the layout plugin for this display.
51   *
52   * @param \Drupal\Core\Layout\LayoutInterface $layout
53   *   A layout plugin.
54   *
55   * @return $this
56   */
57  public function setLayout(LayoutInterface $layout);
58
59  /**
60   * Gets the layout plugin for this display.
61   *
62   * @return \Drupal\Core\Layout\LayoutInterface
63   *   The layout plugin.
64   */
65  public function getLayout();
66
67  /**
68   * Ensures this entity has a layout.
69   *
70   * @param string $default_layout_id
71   *   (optional) The layout ID to use as a default. Defaults to
72   *   'layout_onecol'.
73   *
74   * @return $this
75   */
76  public function ensureLayout($default_layout_id = 'layout_onecol');
77
78}
79