protected function EasyEmailController::buildEntityFromFormState in Easy Email 8
Same name and namespace in other branches
- 2.0.x src/Controller/EasyEmailController.php \Drupal\easy_email\Controller\EasyEmailController::buildEntityFromFormState()
File
- src/
Controller/ EasyEmailController.php, line 56
Class
- EasyEmailController
- Class EasyEmailController.
Namespace
Drupal\easy_email\ControllerCode
protected function buildEntityFromFormState() {
$form_build_id = $this->requestStack
->getCurrentRequest()
->get('form_build_id');
if (!empty($form_build_id)) {
$form_state = new FormState();
$form = $this->formBuilder
->getCache($form_build_id, $form_state);
if (!empty($form)) {
$easy_email = $form_state
->getFormObject()
->buildEntity($form, $form_state);
if ($easy_email
->isNew()) {
// Only allow this to work for previews, not for editing saved emails
return $easy_email;
}
}
}
return NULL;
}