You are here

public function ExportConfirmForm::buildForm in Fixed Block Content 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityConfirmFormBase::buildForm

File

src/Form/ExportConfirmForm.php, line 46

Class

ExportConfirmForm
Export default content confirm form class.

Namespace

Drupal\fixed_block_content\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);

  /** @var \Drupal\fixed_block_content\FixedBlockContentInterface $entity */
  $entity = $this
    ->getEntity();
  if ($block_content = $entity
    ->getBlockContent(FALSE)) {
    $form['update_existing'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Update the existing block content'),
      '#description' => $this
        ->t('The existing block %title (@id) will be updated rather than replace it with a new one.', [
        '%title' => $block_content
          ->label(),
        '@id' => $block_content
          ->id(),
      ]),
      '#default_value' => FALSE,
    ];
  }
  return $form;
}