function custom_block_delete_form

Page callback: Form constructor for the custom block deletion form.

Parameters

Drupal\custom_block\Plugin\Core\Entity\CustomBlock $block: The custom block to be deleted.

See also

custom_block_menu()

custom_block_delete_form_submit()

Related topics

1 string reference to 'custom_block_delete_form'
custom_block_menu in drupal/core/modules/block/custom_block/custom_block.module
Implements hook_menu().

File

drupal/core/modules/block/custom_block/custom_block.pages.inc, line 88
Provides page callbacks for custom blocks.

Code

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'));
}