public function EntityDeleteForm::buildForm

public EntityDeleteForm::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 EntityConfirmFormBase::buildForm

File

core/lib/Drupal/Core/Entity/EntityDeleteForm.php, line 20

Class

EntityDeleteForm
Provides a generic base class for an entity deletion form.

Namespace

Drupal\Core\Entity

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $entity = $this->getEntity();
  // Only do dependency processing for configuration entities. Whilst it is
  // possible for a configuration entity to be dependent on a content entity,
  // these dependencies are soft and content delete permissions are often
  // given to more users. This method should not make assumptions that $entity
  // is a configuration entity in case we decide to remove the following
  // condition.
  if (!($entity instanceof ConfigEntityInterface)) {
    return $form;
  }
  $this->addDependencyListsToForm($form, $entity->getConfigDependencyKey(), $this->getConfigNamesToDelete($entity), $this->getConfigManager(), $this->entityManager);

  return $form;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityDeleteForm.php/function/EntityDeleteForm::buildForm/8.1.x