3 namespace Drupal\ctools\Plugin;
5 use Drupal\Core\Display\VariantInterface;
8 * Provides an interface for variant plugins that use block plugins.
10 interface BlockVariantInterface extends VariantInterface {
13 * Returns the human-readable list of regions keyed by machine name.
16 * An array of human-readable region names keyed by machine name.
18 public function getRegionNames();
21 * Returns the human-readable name of a specific region.
23 * @param string $region
24 * The machine name of a region.
27 * The human-readable name of a region.
29 public function getRegionName($region);
32 * Adds a block to this display variant.
34 * @param array $configuration
35 * An array of block configuration.
40 public function addBlock(array $configuration);
43 * Returns the region a specific block is assigned to.
45 * @param string $block_id
49 * The machine name of the region this block is assigned to.
51 public function getRegionAssignment($block_id);
54 * Returns an array of regions and their block plugins.
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
61 public function getRegionAssignments();
64 * Returns a specific block plugin.
66 * @param string $block_id
69 * @return \Drupal\Core\Block\BlockPluginInterface
72 public function getBlock($block_id);
75 * Updates the configuration of a specific block plugin.
77 * @param string $block_id
79 * @param array $configuration
80 * The array of configuration to set.
84 public function updateBlock($block_id, array $configuration);
87 * Removes a specific block from this display variant.
89 * @param string $block_id
94 public function removeBlock($block_id);