protected function VariantPluginAddBlockForm::prepareBlock in Page Manager 8
Same name and namespace in other branches
- 8.4 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 60 - Contains \Drupal\page_manager_ui\Form\VariantPluginAddBlockForm.
Class
- VariantPluginAddBlockForm
- Provides a form for adding a block plugin to a variant.
Namespace
Drupal\page_manager_ui\FormCode
protected function prepareBlock($plugin_id) {
$block = $this->blockManager
->createInstance($plugin_id);
$block_id = $this
->getVariantPlugin()
->addBlock($block
->getConfiguration());
return $this
->getVariantPlugin()
->getBlock($block_id);
}