Page callback: Form constructor for the custom block deletion form.
Drupal\custom_block\Plugin\Core\Entity\CustomBlock $block: The custom block to be deleted.
custom_block_delete_form_submit()
function custom_block_delete_form($form, &$form_state, CustomBlock $block) {
$form_state['custom_block'] = $block;
$form['id'] = array(
'#type' => 'value',
'#value' => $block
->id(),
);
$instances = $block
->getInstances();
$form['message'] = array(
'#type' => 'markup',
'#markup' => format_plural(count($instances), 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instances.'),
'#access' => !empty($instances),
);
return confirm_form($form, t('Are you sure you want to delete %label?', array(
'%label' => $block
->label(),
)), 'admin/structure/block', t('This action cannot be undone.'), t('Delete'));
}