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