BlockContentDeleteForm::buildForm

public BlockContentDeleteForm::buildForm(array $form, FormStateInterface $form_state)

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 ContentEntityDeleteForm::buildForm

File

core/modules/block_content/src/Form/BlockContentDeleteForm.php, line 16

Class

BlockContentDeleteForm
Provides a confirmation form for deleting a custom block entity.

Namespace

Drupal\block_content\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $instances = $this->entity->getInstances();

  $form['message'] = array(
    '#markup' => $this->formatPlural(count($instances), 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instances.'),
    '#access' => !empty($instances),
  );

  return parent::buildForm($form, $form_state);
}
doc_Drupal
2016-10-29 08:46:53
Comments
Leave a Comment

Please login to continue.