public function InlineBlock::blockForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Plugin/Block/InlineBlock.php \Drupal\layout_builder\Plugin\Block\InlineBlock::blockForm()
- 9 core/modules/layout_builder/src/Plugin/Block/InlineBlock.php \Drupal\layout_builder\Plugin\Block\InlineBlock::blockForm()
File
- core/
modules/ layout_builder/ src/ Plugin/ Block/ InlineBlock.php, line 126
Class
- InlineBlock
- Defines an inline block plugin type.
Namespace
Drupal\layout_builder\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$block = $this
->getEntity();
// Add the entity form display in a process callback so that #parents can
// be successfully propagated to field widgets.
$form['block_form'] = [
'#type' => 'container',
'#process' => [
[
static::class,
'processBlockForm',
],
],
'#block' => $block,
'#access' => $this->currentUser
->hasPermission('create and edit custom blocks'),
];
$options = $this->entityDisplayRepository
->getViewModeOptionsByBundle('block_content', $block
->bundle());
$form['view_mode'] = [
'#type' => 'select',
'#options' => $options,
'#title' => $this
->t('View mode'),
'#description' => $this
->t('The view mode in which to render the block.'),
'#default_value' => $this->configuration['view_mode'],
'#access' => count($options) > 1,
];
return $form;
}