public function ContentEntityDeleteForm::buildForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php \Drupal\Core\Entity\ContentEntityDeleteForm::buildForm()
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 ContentEntityConfirmFormBase::buildForm
2 calls to ContentEntityDeleteForm::buildForm()
- BlockContentDeleteForm::buildForm in core/
modules/ block_content/ src/ Form/ BlockContentDeleteForm.php - Form constructor.
- ContentTranslationDeleteForm::buildForm in core/
modules/ content_translation/ src/ Form/ ContentTranslationDeleteForm.php - Form constructor.
2 methods override ContentEntityDeleteForm::buildForm()
- BlockContentDeleteForm::buildForm in core/
modules/ block_content/ src/ Form/ BlockContentDeleteForm.php - Form constructor.
- ContentTranslationDeleteForm::buildForm in core/
modules/ content_translation/ src/ Form/ ContentTranslationDeleteForm.php - Form constructor.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityDeleteForm.php, line 30 - Contains \Drupal\Core\Entity\ContentEntityDeleteForm.
Class
- ContentEntityDeleteForm
- Provides a generic base class for a content entity deletion form.
Namespace
Drupal\Core\EntityCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $this
->getEntity();
if ($entity
->isDefaultTranslation()) {
if (count($entity
->getTranslationLanguages()) > 1) {
$languages = [];
foreach ($entity
->getTranslationLanguages() as $language) {
$languages[] = $language
->getName();
}
$form['deleted_translations'] = array(
'#theme' => 'item_list',
'#title' => $this
->t('The following @entity-type translations will be deleted:', [
'@entity-type' => $entity
->getEntityType()
->getLowercaseLabel(),
]),
'#items' => $languages,
);
$form['actions']['submit']['#value'] = $this
->t('Delete all translations');
}
}
else {
$form['actions']['submit']['#value'] = $this
->t('Delete @language translation', array(
'@language' => $entity
->language()
->getName(),
));
}
return $form;
}