You are here

public function CloudBlockManager::hasUpdates in Gutenberg 8

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

Compare remote and local version of block.

Parameters

\Drupal\gutenberg_cloud\CloudBlock $block: CloudBlock instance.

Return value

bool True if the local version is older or the same.

File

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

Class

CloudBlockManager
Class CloudBlockManager.

Namespace

Drupal\gutenberg_cloud

Code

public function hasUpdates(CloudBlock $block) {
  $localBlocks = $this
    ->loadInstalledBlocks();
  $localBlock = $localBlocks[$block
    ->getName()] ?? NULL;
  if (empty($localBlocks)) {
    return FALSE;
  }
  return $block
    ->getVersion() > $localBlock
    ->getVersion();
}