public function FixedBlockContentDeleteForm::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/ FixedBlockContentDeleteForm.php, line 49
Class
- FixedBlockContentDeleteForm
- Fixed block content entity deletion form.
Namespace
Drupal\fixed_block_content\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
/** @var \Drupal\fixed_block_content\FixedBlockContentInterface $entity */
$entity = $this
->getEntity();
$this
->addDependencyListsToForm($form, $entity
->getConfigDependencyKey(), [
$entity
->getConfigDependencyName(),
], $this->configManager, $this->entityTypeManager);
// Option to delete the reusable linked block.
if (!$entity
->isProtected() && ($block_content = $entity
->getBlockContent(FALSE))) {
$form['delete_linked_block'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Delete the linked custom block as well'),
'#description' => $this
->t('Check to delete the custom block %title (@id).', [
'%title' => $block_content
->label(),
'@id' => $block_content
->id(),
]),
'#default_value' => FALSE,
];
}
return $form;
}