You are here

function contact_emails_update_8002 in Contact Emails 8

Modify how the recipient type is stored.

File

./contact_emails.install, line 71
Contact emails database table.

Code

function contact_emails_update_8002(&$sandbox) {
  $connection = \Drupal::database();
  $schema = $connection
    ->schema();
  if ($connection
    ->schema()
    ->tableExists('contact_message_email_settings')) {

    // Add the new recipient field for when the recipient type is field.
    $recipient_reference = [
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'default' => '',
      'description' => 'The field to send to if recipient type is reference.',
    ];
    if (!$schema
      ->fieldExists('contact_message_email_settings', 'recipient_reference')) {
      $schema
        ->addField('contact_message_email_settings', 'recipient_reference', $recipient_reference);
    }
  }
}