You are here

public function MultiblockDeleteForm::buildForm in MultiBlock 8

Same name in this branch
  1. 8 src/MultiblockDeleteForm.php \Drupal\multiblock\MultiblockDeleteForm::buildForm()
  2. 8 src/Form/MultiblockDeleteForm.php \Drupal\multiblock\Form\MultiblockDeleteForm::buildForm()

File

src/MultiblockDeleteForm.php, line 13

Class

MultiblockDeleteForm

Namespace

Drupal\multiblock

Code

public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state, $delta = NULL) {
  $block = multiblock_get_block($delta);
  if (empty($block)) {
    drupal_set_message(t('The multiblock with the delta @delta was not found.', [
      '@delta' => $delta,
    ]), 'error');
    return [];
  }
  $form['delta'] = [
    '#type' => 'value',
    '#value' => $delta,
  ];
  return confirm_form($form, t('Delete the block instance %title?', [
    '%title' => $block->title,
  ]), 'admin/structure/block/instances', t('This will delete the instance of the block %title.', [
    '%title' => $block->title,
  ]), t('Delete'), t('Cancel'));
}