You are here

protected function EasyEmailForm::setValuesFromFormState in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x src/Form/EasyEmailForm.php \Drupal\easy_email\Form\EasyEmailForm::setValuesFromFormState()

Set the form state values from the custom form into the entity.

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

EasyEmailInterface $entity:

3 calls to EasyEmailForm::setValuesFromFormState()
EasyEmailForm::preview in src/Form/EasyEmailForm.php
Form submit handler for previewing an easy email type template.
EasyEmailForm::save in src/Form/EasyEmailForm.php
Form submission handler for the 'save' action.
EasyEmailForm::validateForm in src/Form/EasyEmailForm.php
Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level…

File

src/Form/EasyEmailForm.php, line 349

Class

EasyEmailForm
Form controller for Email edit forms.

Namespace

Drupal\easy_email\Form

Code

protected function setValuesFromFormState(array $form, FormStateInterface $form_state) {
  $this->entity = $this
    ->buildEntity($form, $form_state);
  $this->entity
    ->setRecipientAddresses($this
    ->explodeAndTrim($form_state
    ->getValue('recipient')))
    ->setCCAddresses($this
    ->explodeAndTrim($form_state
    ->getValue('cc')))
    ->setBCCAddresses($this
    ->explodeAndTrim($form_state
    ->getValue('bcc')))
    ->setFromName($form_state
    ->getValue('fromName'))
    ->setFromAddress($form_state
    ->getValue('fromAddress'))
    ->setReplyToAddress($form_state
    ->getValue('replyToAddress'))
    ->setAttachmentPaths($this
    ->explodeAndTrim($form_state
    ->getValue('attachment_paths')))
    ->setHtmlBody($form_state
    ->getValue([
    'bodyHtml',
    'value',
  ]), $form_state
    ->getValue([
    'bodyHtml',
    'format',
  ]))
    ->setPlainBody($form_state
    ->getValue('bodyPlain'))
    ->setInboxPreview($form_state
    ->getValue('inboxPreview'))
    ->setSubject($form_state
    ->getValue('subjectText'));
}