You are here

function webform_email_reply_insert in Webform Email Reply 8

Same name and namespace in other branches
  1. 7.2 webform_email_reply.module \webform_email_reply_insert()
  2. 7 webform_email_reply.module \webform_email_reply_insert()

Function to insert the email into the database.

Parameters

array $data: The values to insert into the database.

1 call to webform_email_reply_insert()
WebformEmailReplyForm::submitForm in src/Form/WebformEmailReplyForm.php
Form submission handler.

File

./webform_email_reply.module, line 31
This module provides a way for users to reply to webform submissions within the CMS.

Code

function webform_email_reply_insert(array $data) {

  // Need the user replying to the submission.
  $user = \Drupal::currentUser();

  // Simple insert.
  \Drupal::database()
    ->insert('webform_email_reply')
    ->fields([
    'eid' => NULL,
    'sid' => $data['sid'],
    'webform_id' => $data['webform_id'],
    'uid' => $user
      ->id(),
    'from_address' => $data['from_address'],
    'replied' => time(),
    'message' => $data['message'],
    'fid' => $data['fid'],
  ])
    ->execute();
}