BlockFieldManager.php in Block field 8
File
src/BlockFieldManager.php
View source
<?php
namespace Drupal\block_field;
use Drupal\Core\Block\BlockManagerInterface;
use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
class BlockFieldManager implements BlockFieldManagerInterface {
protected $blockManager;
protected $contextRepository;
public function __construct(BlockManagerInterface $block_manager, ContextRepositoryInterface $context_repository) {
$this->blockManager = $block_manager;
$this->contextRepository = $context_repository;
}
public function getBlockDefinitions() {
$definitions = $this->blockManager
->getDefinitionsForContexts($this->contextRepository
->getAvailableContexts());
return $this->blockManager
->getSortedDefinitions($definitions);
}
public function getBlockCategories() {
return $this->blockManager
->getCategories();
}
}