function BlockContentBlock::blockForm
Overrides \Drupal\Core\Block\BlockBase::blockForm().
Adds body and description fields to the block configuration form.
Overrides BlockPluginTrait::blockForm
File
- 
              core/modules/ block_content/ src/ Plugin/ Block/ BlockContentBlock.php, line 146 
Class
- BlockContentBlock
- Defines a generic block type.
Namespace
Drupal\block_content\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
  $block = $this->getEntity();
  if (!$block) {
    return $form;
  }
  $options = $this->entityDisplayRepository
    ->getViewModeOptionsByBundle('block_content', $block->bundle());
  $form['view_mode'] = [
    '#type' => 'select',
    '#options' => $options,
    '#title' => $this->t('View mode'),
    '#description' => $this->t('Output the block in this view mode.'),
    '#default_value' => $this->configuration['view_mode'],
    '#access' => count($options) > 1,
  ];
  $form['title']['#description'] = $this->t('The title of the block as shown to the user.');
  return $form;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
