Same name and namespace in other branches
  1. 8.9.x core/modules/block_content/src/BlockContentForm.php \Drupal\block_content\BlockContentForm::form()
  2. 9 core/modules/block_content/src/BlockContentForm.php \Drupal\block_content\BlockContentForm::form()

Gets the actual form array to be built.

Overrides ContentEntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

core/modules/block_content/src/BlockContentForm.php, line 26

Class

BlockContentForm
Form handler for the content block edit forms.

Namespace

Drupal\block_content

Code

public function form(array $form, FormStateInterface $form_state) {
  $block = $this->entity;
  $form = parent::form($form, $form_state);
  if ($this->operation == 'edit') {
    $form['#title'] = $this
      ->t('Edit content block %label', [
      '%label' => $block
        ->label(),
    ]);
  }

  // Override the default CSS class name, since the user-defined content block
  // type name in 'TYPE-block-form' potentially clashes with third-party class
  // names.
  $form['#attributes']['class'][0] = 'block-' . Html::getClass($block
    ->bundle()) . '-form';
  return $form;
}