Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\block;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Block\BlockPluginInterface;
|
Chris@0
|
6 use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
Chris@0
|
7
|
Chris@0
|
8 /**
|
Chris@0
|
9 * Provides an interface defining a block entity.
|
Chris@0
|
10 */
|
Chris@0
|
11 interface BlockInterface extends ConfigEntityInterface {
|
Chris@0
|
12
|
Chris@0
|
13 /**
|
Chris@0
|
14 * Indicates the block label (title) should be displayed to end users.
|
Chris@0
|
15 *
|
Chris@0
|
16 * @deprecated in Drupal 8.3.x, will be removed before Drupal 9.0.0.
|
Chris@0
|
17 * Use \Drupal\Core\Block\BlockPluginInterface::BLOCK_LABEL_VISIBLE.
|
Chris@0
|
18 *
|
Chris@0
|
19 * @see https://www.drupal.org/node/2829775
|
Chris@0
|
20 */
|
Chris@0
|
21 const BLOCK_LABEL_VISIBLE = BlockPluginInterface::BLOCK_LABEL_VISIBLE;
|
Chris@0
|
22
|
Chris@0
|
23 /**
|
Chris@0
|
24 * Denotes that a block is not enabled in any region and should not be shown.
|
Chris@0
|
25 *
|
Chris@0
|
26 * @deprecated Scheduled for removal in Drupal 9.0.0.
|
Chris@0
|
27 */
|
Chris@0
|
28 const BLOCK_REGION_NONE = -1;
|
Chris@0
|
29
|
Chris@0
|
30 /**
|
Chris@0
|
31 * Returns the plugin instance.
|
Chris@0
|
32 *
|
Chris@0
|
33 * @return \Drupal\Core\Block\BlockPluginInterface
|
Chris@0
|
34 * The plugin instance for this block.
|
Chris@0
|
35 */
|
Chris@0
|
36 public function getPlugin();
|
Chris@0
|
37
|
Chris@0
|
38 /**
|
Chris@0
|
39 * Returns the plugin ID.
|
Chris@0
|
40 *
|
Chris@0
|
41 * @return string
|
Chris@0
|
42 * The plugin ID for this block.
|
Chris@0
|
43 */
|
Chris@0
|
44 public function getPluginId();
|
Chris@0
|
45
|
Chris@0
|
46 /**
|
Chris@0
|
47 * Returns the region this block is placed in.
|
Chris@0
|
48 *
|
Chris@0
|
49 * @return string
|
Chris@0
|
50 * The region this block is placed in.
|
Chris@0
|
51 */
|
Chris@0
|
52 public function getRegion();
|
Chris@0
|
53
|
Chris@0
|
54 /**
|
Chris@0
|
55 * Returns the theme ID.
|
Chris@0
|
56 *
|
Chris@0
|
57 * @return string
|
Chris@0
|
58 * The theme ID for this block instance.
|
Chris@0
|
59 */
|
Chris@0
|
60 public function getTheme();
|
Chris@0
|
61
|
Chris@0
|
62 /**
|
Chris@0
|
63 * Returns an array of visibility condition configurations.
|
Chris@0
|
64 *
|
Chris@0
|
65 * @return array
|
Chris@0
|
66 * An array of visibility condition configuration keyed by the condition ID.
|
Chris@0
|
67 */
|
Chris@0
|
68 public function getVisibility();
|
Chris@0
|
69
|
Chris@0
|
70 /**
|
Chris@0
|
71 * Gets conditions for this block.
|
Chris@0
|
72 *
|
Chris@0
|
73 * @return \Drupal\Core\Condition\ConditionInterface[]|\Drupal\Core\Condition\ConditionPluginCollection
|
Chris@0
|
74 * An array or collection of configured condition plugins.
|
Chris@0
|
75 */
|
Chris@0
|
76 public function getVisibilityConditions();
|
Chris@0
|
77
|
Chris@0
|
78 /**
|
Chris@0
|
79 * Gets a visibility condition plugin instance.
|
Chris@0
|
80 *
|
Chris@0
|
81 * @param string $instance_id
|
Chris@0
|
82 * The condition plugin instance ID.
|
Chris@0
|
83 *
|
Chris@0
|
84 * @return \Drupal\Core\Condition\ConditionInterface
|
Chris@0
|
85 * A condition plugin.
|
Chris@0
|
86 */
|
Chris@0
|
87 public function getVisibilityCondition($instance_id);
|
Chris@0
|
88
|
Chris@0
|
89 /**
|
Chris@0
|
90 * Sets the visibility condition configuration.
|
Chris@0
|
91 *
|
Chris@0
|
92 * @param string $instance_id
|
Chris@0
|
93 * The condition instance ID.
|
Chris@0
|
94 * @param array $configuration
|
Chris@0
|
95 * The condition configuration.
|
Chris@0
|
96 *
|
Chris@0
|
97 * @return $this
|
Chris@0
|
98 */
|
Chris@0
|
99 public function setVisibilityConfig($instance_id, array $configuration);
|
Chris@0
|
100
|
Chris@0
|
101 /**
|
Chris@0
|
102 * Returns the weight of this block (used for sorting).
|
Chris@0
|
103 *
|
Chris@0
|
104 * @return int
|
Chris@0
|
105 * The block weight.
|
Chris@0
|
106 */
|
Chris@0
|
107 public function getWeight();
|
Chris@0
|
108
|
Chris@0
|
109 /**
|
Chris@0
|
110 * Sets the region this block is placed in.
|
Chris@0
|
111 *
|
Chris@0
|
112 * @param string $region
|
Chris@0
|
113 * The region to place this block in.
|
Chris@0
|
114 *
|
Chris@0
|
115 * @return $this
|
Chris@0
|
116 */
|
Chris@0
|
117 public function setRegion($region);
|
Chris@0
|
118
|
Chris@0
|
119 /**
|
Chris@0
|
120 * Sets the block weight.
|
Chris@0
|
121 *
|
Chris@0
|
122 * @param int $weight
|
Chris@0
|
123 * The desired weight.
|
Chris@0
|
124 *
|
Chris@0
|
125 * @return $this
|
Chris@0
|
126 */
|
Chris@0
|
127 public function setWeight($weight);
|
Chris@0
|
128
|
Chris@0
|
129 /**
|
Chris@0
|
130 * Creates a duplicate of the block entity.
|
Chris@0
|
131 *
|
Chris@0
|
132 * @param string $new_id
|
Chris@0
|
133 * (optional) The new ID on the duplicate block.
|
Chris@0
|
134 * @param string $new_theme
|
Chris@0
|
135 * (optional) The theme on the duplicate block.
|
Chris@0
|
136 *
|
Chris@0
|
137 * @return static
|
Chris@0
|
138 * A clone of $this with all identifiers unset, so saving it inserts a new
|
Chris@0
|
139 * entity into the storage system.
|
Chris@0
|
140 */
|
Chris@0
|
141 public function createDuplicateBlock($new_id = NULL, $new_theme = NULL);
|
Chris@0
|
142
|
Chris@0
|
143 }
|