public function TemplateEditForm::cancelForm in Courier 2.x
Same name and namespace in other branches
- 8 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 137
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 \Drupal\courier\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);
}