function InlineBlock::blockForm
Overrides BlockPluginTrait::blockForm
File
- 
              core/modules/ layout_builder/ src/ Plugin/ Block/ InlineBlock.php, line 129 
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;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
