aa2709aceb6b892926c7691140f92c76b38bc471
[yaffs-website] / Plugin / BlockVariantInterface.php
1 <?php
2
3 namespace Drupal\ctools\Plugin;
4
5 use Drupal\Core\Display\VariantInterface;
6
7 /**
8  * Provides an interface for variant plugins that use block plugins.
9  */
10 interface BlockVariantInterface extends VariantInterface {
11
12   /**
13    * Returns the human-readable list of regions keyed by machine name.
14    *
15    * @return array
16    *   An array of human-readable region names keyed by machine name.
17    */
18   public function getRegionNames();
19
20   /**
21    * Returns the human-readable name of a specific region.
22    *
23    * @param string $region
24    *   The machine name of a region.
25    *
26    * @return string
27    *   The human-readable name of a region.
28    */
29   public function getRegionName($region);
30
31   /**
32    * Adds a block to this display variant.
33    *
34    * @param array $configuration
35    *   An array of block configuration.
36    *
37    * @return string
38    *   The block ID.
39    */
40   public function addBlock(array $configuration);
41
42   /**
43    * Returns the region a specific block is assigned to.
44    *
45    * @param string $block_id
46    *   The block ID.
47    *
48    * @return string
49    *   The machine name of the region this block is assigned to.
50    */
51   public function getRegionAssignment($block_id);
52
53   /**
54    * Returns an array of regions and their block plugins.
55    *
56    * @return array
57    *   The array is first keyed by region machine name, with the values
58    *   containing an array keyed by block ID, with block plugin instances as the
59    *   values.
60    */
61   public function getRegionAssignments();
62
63   /**
64    * Returns a specific block plugin.
65    *
66    * @param string $block_id
67    *   The block ID.
68    *
69    * @return \Drupal\Core\Block\BlockPluginInterface
70    *   The block plugin.
71    */
72   public function getBlock($block_id);
73
74   /**
75    * Updates the configuration of a specific block plugin.
76    *
77    * @param string $block_id
78    *   The block ID.
79    * @param array $configuration
80    *   The array of configuration to set.
81    *
82    * @return $this
83    */
84   public function updateBlock($block_id, array $configuration);
85
86   /**
87    * Removes a specific block from this display variant.
88    *
89    * @param string $block_id
90    *   The block ID.
91    *
92    * @return $this
93    */
94   public function removeBlock($block_id);
95
96 }