public function LingotekProfileDeleteForm::submitForm in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 4.0.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.0.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.1.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.2.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.3.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.4.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.5.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.6.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.7.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
- 3.8.x src/Form/LingotekProfileDeleteForm.php \Drupal\lingotek\Form\LingotekProfileDeleteForm::submitForm()
Overrides EntityDeleteFormTrait::submitForm
File
- src/
Form/ LingotekProfileDeleteForm.php, line 65 - Contains \Drupal\lingotek\Form\LingotekProfileDeleteForm.
Class
- LingotekProfileDeleteForm
- Provides a form for lingotek profiles deletion.
Namespace
Drupal\lingotek\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$profile = $this
->getEntity();
$usages = $this->profileUsage
->isUsedByContent($profile) | $this->profileUsage
->isUsedByConfig($profile) | $this->profileUsage
->isUsedByContentSettings($profile);
if (!$usages) {
$profile
->delete();
drupal_set_message($this
->t('The lingotek profile %profile has been deleted.', [
'%profile' => $profile
->label(),
]));
}
else {
drupal_set_message($this
->t('The Lingotek profile %profile is being used so cannot be deleted.', [
'%profile' => $profile
->label(),
]), 'error');
}
$form_state
->setRedirectUrl($this
->getCancelUrl());
}