function InlineBlockEntityOperations::getPluginBlockId

Same name in other branches
  1. 9 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 208

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.