You are here

protected function PanelsAddBlockForm::prepareBlock in Panels 8.4

Same name and namespace in other branches
  1. 8.3 src/Form/PanelsAddBlockForm.php \Drupal\panels\Form\PanelsAddBlockForm::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 PanelsBlockConfigureFormBase::prepareBlock

File

src/Form/PanelsAddBlockForm.php, line 56

Class

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

Namespace

Drupal\panels\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);
}