You are here

function contact_storage_contact_form_form_builder in Contact Storage 8

Entity builder for the contact form edit form with third party options.

See also

contact_storage_test_form_contact_form_edit_form_alter()

1 string reference to 'contact_storage_contact_form_form_builder'
contact_storage_form_contact_form_form_alter in ./contact_storage.module
Implements hook_form_FORM_ID_alter() for contact_form_form().

File

./contact_storage.module, line 123
Contains main module logic.

Code

function contact_storage_contact_form_form_builder($entity_type, ContactFormInterface $contact_form, &$form, FormStateInterface $form_state) {
  $contact_form
    ->setThirdPartySetting('contact_storage', 'submit_text', $form_state
    ->getValue('contact_storage_submit_text'));
  $contact_form
    ->setThirdPartySetting('contact_storage', 'show_preview', $form_state
    ->getValue('contact_storage_preview'));
  $contact_form
    ->setThirdPartySetting('contact_storage', 'disabled_form_message', $form_state
    ->getValue('contact_storage_disabled_form_message'));
  $contact_form
    ->setThirdPartySetting('contact_storage', 'maximum_submissions_user', $form_state
    ->getValue('contact_storage_maximum_submissions_user'));

  // Auto-reply value is handled by Core; 'reply' is expected to be a string.
  $reply = $form_state
    ->getValue('reply');
  if (isset($reply['value'])) {
    $form_state
      ->setValue('reply', $reply['value']);
    $contact_form
      ->setThirdPartySetting('contact_storage', 'page_autoreply_format', $reply['format']);
  }
}