You are here

protected function InlineBlockEntityOperations::getPluginBlockId in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::getPluginBlockId()

Gets a block ID for an inline block plugin.

Parameters

\Drupal\layout_builder\Plugin\Block\InlineBlock $block_plugin: The inline block plugin.

Return value

int The block content ID or null none available.

1 call to InlineBlockEntityOperations::getPluginBlockId()
InlineBlockEntityOperations::saveInlineBlockComponent in core/modules/layout_builder/src/InlineBlockEntityOperations.php
Saves an inline block component.

File

core/modules/layout_builder/src/InlineBlockEntityOperations.php, line 186

Class

InlineBlockEntityOperations
Defines a class for reacting to entity events related to Inline Blocks.

Namespace

Drupal\layout_builder

Code

protected function getPluginBlockId(InlineBlock $block_plugin) {
  $configuration = $block_plugin
    ->getConfiguration();
  if (!empty($configuration['block_revision_id'])) {
    $revision_ids = $this
      ->getBlockIdsForRevisionIds([
      $configuration['block_revision_id'],
    ]);
    return array_pop($revision_ids);
  }
  return NULL;
}