You are here

public function Blocks::getBlocks in Context 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/ContextReaction/Blocks.php \Drupal\context\Plugin\ContextReaction\Blocks::getBlocks()
  2. 8.0 src/Plugin/ContextReaction/Blocks.php \Drupal\context\Plugin\ContextReaction\Blocks::getBlocks()

Get all blocks as a collection.

Return value

BlockPluginInterface[]|BlockCollection

File

src/Plugin/ContextReaction/Blocks.php, line 341

Class

Blocks
Provides a content reaction that will let you place blocks in the current themes regions.

Namespace

Drupal\context\Plugin\ContextReaction

Code

public function getBlocks() {
  if (!$this->blocksCollection) {
    $blockManager = \Drupal::service('plugin.manager.block');
    $this->blocksCollection = new BlockCollection($blockManager, $this->blocks);
  }
  return $this->blocksCollection;
}