public function TemplateEditForm::cancelForm in Courier 8
Same name and namespace in other branches
- 2.x src/Form/TemplateEditForm.php \Drupal\courier\Form\TemplateEditForm::cancelForm()
Cancels the form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Form/ TemplateEditForm.php, line 135
Class
- TemplateEditForm
- Create a message.
Namespace
Drupal\courier\FormCode
public function cancelForm(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\courier\ChannelInterface $message */
$message = $form_state
->get('message_entity');
/** @var TemplateCollectionInterface $template_collection */
$template_collection = $form_state
->get('template_collection');
$response = new AjaxResponse();
$response
->addCommand(new CourierTemplate($template_collection
->id(), $message
->getEntityTypeId(), 'close'));
$form_state
->setResponse($response);
}