You are here

protected function VariantPluginAddBlockForm::prepareBlock in Page Manager 8.4

Same name and namespace in other branches
  1. 8 page_manager_ui/src/Form/VariantPluginAddBlockForm.php \Drupal\page_manager_ui\Form\VariantPluginAddBlockForm::prepareBlock()

Prepares the block plugin based on the block ID.

Parameters

string $block_id: Either a block ID, or the plugin ID used to create a new block.

Return value

\Drupal\Core\Block\BlockPluginInterface The block plugin.

Overrides VariantPluginConfigureBlockFormBase::prepareBlock

File

page_manager_ui/src/Form/VariantPluginAddBlockForm.php, line 56

Class

VariantPluginAddBlockForm
Provides a form for adding a block plugin to a variant.

Namespace

Drupal\page_manager_ui\Form

Code

protected function prepareBlock($plugin_id) {
  $block = $this->blockManager
    ->createInstance($plugin_id);
  $block_id = $this
    ->getVariantPlugin()
    ->addBlock($block
    ->getConfiguration());
  return $this
    ->getVariantPlugin()
    ->getBlock($block_id);
}