You are here

public function CloudBlockManager::loadInstalledBlocks in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 modules/gutenberg_cloud/src/CloudBlockManager.php \Drupal\gutenberg_cloud\CloudBlockManager::loadInstalledBlocks()

Load installed blocks, saved in the config.

Return value

array Array of CloudBlock instances or empty array if no results.

2 calls to CloudBlockManager::loadInstalledBlocks()
CloudBlockManager::hasUpdates in modules/gutenberg_cloud/src/CloudBlockManager.php
Compare remote and local version of block.
CloudBlockManager::isBlockEnabled in modules/gutenberg_cloud/src/CloudBlockManager.php
Check if the block is enabled locally.

File

modules/gutenberg_cloud/src/CloudBlockManager.php, line 139

Class

CloudBlockManager
Class CloudBlockManager.

Namespace

Drupal\gutenberg_cloud

Code

public function loadInstalledBlocks() {
  $blocks = [];
  $localBlocks = $this
    ->getConfig()
    ->get();
  foreach ($localBlocks as $block) {
    $cloudBlock = new CloudBlock($block);
    $blocks[$cloudBlock
      ->getName()] = $cloudBlock;
  }
  return $blocks;
}