Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\display_builder;
6
7use Drupal\Core\Entity\ContentEntityInterface;
8use Drupal\display_builder\Entity\HistoryInterface;
9use Drupal\display_builder\Entity\ProfileInterface;
10
11/**
12 * Provides an interface defining a display builder instance entity type.
13 */
14interface InstanceInterface extends ContentEntityInterface, HistoryInterface, PublishableInterface {
15
16  /**
17   * Returns the display builder profile.
18   *
19   * @return \Drupal\display_builder\Entity\ProfileInterface|null
20   *   The display builder profile.
21   */
22  public function getProfile(): ?ProfileInterface;
23
24  /**
25   * Set the display builder profile from id.
26   *
27   * @param string $profile_id
28   *   Entity ID of the display builder profile.
29   */
30  public function setProfile(string $profile_id): void;
31
32  /**
33   * Move a source to root.
34   *
35   * @param string $node_id
36   *   The node ID of the source.
37   * @param int $position
38   *   The position.
39   *
40   * @return bool
41   *   True if success, false otherwise.
42   */
43  public function moveToRoot(string $node_id, int $position): bool;
44
45  /**
46   * Attach a new source to root.
47   *
48   * @param int $position
49   *   The position.
50   * @param string $source_id
51   *   The source ID.
52   * @param array $data
53   *   The source data.
54   * @param array $third_party_settings
55   *   (Optional) The source third party settings. Used for paste/duplicate.
56   *
57   * @return string
58   *   The node ID of the source.
59   */
60  public function attachToRoot(int $position, string $source_id, array $data, array $third_party_settings = []): string;
61
62  /**
63   * Attach a new source to a slot.
64   *
65   * @param string $parent_id
66   *   The parent id.
67   * @param string $slot_id
68   *   The slot id.
69   * @param int $position
70   *   The position.
71   * @param string $source_id
72   *   The source ID.
73   * @param array $data
74   *   The source data.
75   * @param array $third_party_settings
76   *   (Optional) The source third party settings. Used for paste/duplicate.
77   *
78   * @return string
79   *   The node ID of the source.
80   */
81  public function attachToSlot(string $parent_id, string $slot_id, int $position, string $source_id, array $data, array $third_party_settings = []): string;
82
83  /**
84   * Move a source to a slot.
85   *
86   * @param string $node_id
87   *   The node ID of the source.
88   * @param string $parent_id
89   *   The parent id.
90   * @param string $slot_id
91   *   The slot id.
92   * @param int $position
93   *   The position.
94   *
95   * @return bool
96   *   True if success, false otherwise.
97   */
98  public function moveToSlot(string $node_id, string $parent_id, string $slot_id, int $position): bool;
99
100  /**
101   * Get node data.
102   *
103   * @param string $node_id
104   *   The node ID of the source.
105   *
106   * @return array
107   *   The node data.
108   */
109  public function getNode(string $node_id): array;
110
111  /**
112   * Get the parent id of an node.
113   *
114   * @param string $node_id
115   *   The node ID of the source.
116   *
117   * @return string
118   *   The parent node id. Empty if the node is at the root level.
119   */
120  public function getParentId(string $node_id): ?string;
121
122  /**
123   * Set the source for a tree node.
124   *
125   * @param string $node_id
126   *   The node ID of the source.
127   * @param string $source_id
128   *   The source id.
129   * @param array $data
130   *   The source data.
131   */
132  public function setSource(string $node_id, string $source_id, array $data): void;
133
134  /**
135   * Set the third party settings for a tree node.
136   *
137   * @param string $node_id
138   *   The node ID of the source.
139   * @param string $island_id
140   *   The island id (relative to third party settings).
141   * @param array $data
142   *   The third party data for the island.
143   */
144  public function setThirdPartySettings(string $node_id, string $island_id, array $data): void;
145
146  /**
147   * Remove an tree node.
148   *
149   * @param string $node_id
150   *   The node ID of the source.
151   */
152  public function remove(string $node_id): void;
153
154  /**
155   * Set the save value of a display builder.
156   *
157   * @param array $save_data
158   *   The builder data to save.
159   */
160  public function setSave(array $save_data): void;
161
162  /**
163   * Gets the values for all defined contexts.
164   *
165   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
166   *   An array of set contexts, keyed by context name.
167   */
168  public function getContexts(): array;
169
170  /**
171   * Get users.
172   *
173   * All users which have authored a step in present, past or future, with the
174   * most recent date of action.
175   *
176   * @return array
177   *   Each key is an User entity ID, each value is a timestamp.
178   */
179  public function getUsers(): array;
180
181  /**
182   * Get the path index.
183   *
184   * @return array
185   *   The path index.
186   */
187  public function getPathIndex(): array;
188
189  /**
190   * Get a hash for this data as uniq id reference.
191   *
192   * @param array $data
193   *   The data to generate uniq id for.
194   *
195   * @return int
196   *   The uniq id value.
197   */
198  public static function getUniqId(array $data): int;
199
200}