public function DeleteForm::submitForm in Linkit 8.4
Same name in this branch
- 8.4 src/Form/Attribute/DeleteForm.php \Drupal\linkit\Form\Attribute\DeleteForm::submitForm()
- 8.4 src/Form/Matcher/DeleteForm.php \Drupal\linkit\Form\Matcher\DeleteForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ Attribute/ DeleteForm.php, line 75 - Contains \Drupal\linkit\Form\Attribute\DeleteForm.
Class
- DeleteForm
- Provides a form to remove an attribute from a profile.
Namespace
Drupal\linkit\Form\AttributeCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($this->linkitProfile
->getAttributes()
->has($this->linkitAttribute
->getPluginId())) {
$this->linkitProfile
->removeAttribute($this->linkitAttribute
->getPluginId());
$this->linkitProfile
->save();
drupal_set_message($this
->t('The attribute %label has been deleted.', [
'%label' => $this->linkitAttribute
->getLabel(),
]));
$this
->logger('linkit')
->notice('The attribute %label has been deleted in the @profile profile.', [
'%label' => $this->linkitAttribute
->getLabel(),
'@profile' => $this->linkitProfile
->label(),
]);
}
$form_state
->setRedirect('linkit.attributes', [
'linkit_profile' => $this->linkitProfile
->id(),
]);
}