You are here

interface BlockVariantInterface in Chaos Tool Suite (ctools) 8.3

Provides an interface for variant plugins that use block plugins.

Hierarchy

Expanded class hierarchy of BlockVariantInterface

All classes that implement BlockVariantInterface

2 files declare their use of BlockVariantInterface
BlockDisplayVariant.php in src/Plugin/DisplayVariant/BlockDisplayVariant.php
BlockVariantEvent.php in src/Event/BlockVariantEvent.php

File

src/Plugin/BlockVariantInterface.php, line 10

Namespace

Drupal\ctools\Plugin
View source
interface BlockVariantInterface extends VariantInterface {

  /**
   * Returns the human-readable list of regions keyed by machine name.
   *
   * @return array
   *   An array of human-readable region names keyed by machine name.
   */
  public function getRegionNames();

  /**
   * Returns the human-readable name of a specific region.
   *
   * @param string $region
   *   The machine name of a region.
   *
   * @return string
   *   The human-readable name of a region.
   */
  public function getRegionName($region);

  /**
   * Adds a block to this display variant.
   *
   * @param array $configuration
   *   An array of block configuration.
   *
   * @return string
   *   The block ID.
   */
  public function addBlock(array $configuration);

  /**
   * Returns the region a specific block is assigned to.
   *
   * @param string $block_id
   *   The block ID.
   *
   * @return string
   *   The machine name of the region this block is assigned to.
   */
  public function getRegionAssignment($block_id);

  /**
   * Returns an array of regions and their block plugins.
   *
   * @return array
   *   The array is first keyed by region machine name, with the values
   *   containing an array keyed by block ID, with block plugin instances as the
   *   values.
   */
  public function getRegionAssignments();

  /**
   * Returns a specific block plugin.
   *
   * @param string $block_id
   *   The block ID.
   *
   * @return \Drupal\Core\Block\BlockPluginInterface
   *   The block plugin.
   */
  public function getBlock($block_id);

  /**
   * Updates the configuration of a specific block plugin.
   *
   * @param string $block_id
   *   The block ID.
   * @param array $configuration
   *   The array of configuration to set.
   *
   * @return $this
   */
  public function updateBlock($block_id, array $configuration);

  /**
   * Removes a specific block from this display variant.
   *
   * @param string $block_id
   *   The block ID.
   *
   * @return $this
   */
  public function removeBlock($block_id);

}

Members

Namesort descending Modifiers Type Description Overrides
BlockVariantInterface::addBlock public function Adds a block to this display variant.
BlockVariantInterface::getBlock public function Returns a specific block plugin.
BlockVariantInterface::getRegionAssignment public function Returns the region a specific block is assigned to.
BlockVariantInterface::getRegionAssignments public function Returns an array of regions and their block plugins.
BlockVariantInterface::getRegionName public function Returns the human-readable name of a specific region.
BlockVariantInterface::getRegionNames public function Returns the human-readable list of regions keyed by machine name.
BlockVariantInterface::removeBlock public function Removes a specific block from this display variant.
BlockVariantInterface::updateBlock public function Updates the configuration of a specific block plugin.
CacheableDependencyInterface::getCacheContexts public function The cache contexts associated with this object. 34
CacheableDependencyInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 34
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 27
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
RefinableCacheableDependencyInterface::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. 1
RefinableCacheableDependencyInterface::addCacheContexts public function Adds cache contexts. 1
RefinableCacheableDependencyInterface::addCacheTags public function Adds cache tags. 1
RefinableCacheableDependencyInterface::mergeCacheMaxAge public function Merges the maximum age (in seconds) with the existing maximum age. 1
VariantInterface::access public function Determines if this display variant is accessible. 1
VariantInterface::adminLabel public function Returns the admin-facing display variant label. 1
VariantInterface::build public function Builds and returns the renderable array for the display variant. 3
VariantInterface::getWeight public function Returns the weight of the display variant. 1
VariantInterface::id public function Returns the unique ID for the display variant. 1
VariantInterface::label public function Returns the user-facing display variant label. 1
VariantInterface::setWeight public function Sets the weight of the display variant. 1