You are here

public function Utility::faqAskSetFaqNotification in FAQ_Ask 8

Helper function to set a notification associated with a node.

1 call to Utility::faqAskSetFaqNotification()
faq_ask_submit in ./faq_ask.module
Handles the ask form submission.

File

src/Utility.php, line 177
Contains \Drupal\faq_ask\Utility.

Class

Utility
Contains static helper functions for FAQ module.

Namespace

Drupal\faq_ask

Code

public function faqAskSetFaqNotification($nid, $email) {
  if (!$nid) {
    drupal_set_message(t('Attempt to insert notification to @email for no node ID. Insert failed.', array(
      '@email' => $email,
    )), 'error');
    return;
  }
  \Drupal::database()
    ->insert('faq_ask_notify')
    ->fields(array(
    'nid' => $nid,
    'email' => $email,
  ))
    ->execute();
}