You are here

protected function MandrillMail::isValidContentType in Mandrill 8

Helper to determine if an attachment is valid.

Parameters

string $file_type: The file mime type.

Return value

bool True or false.

1 call to MandrillMail::isValidContentType()
MandrillMail::getAttachmentStruct in src/Plugin/Mail/MandrillMail.php
Return an array structure for a message attachment.

File

src/Plugin/Mail/MandrillMail.php, line 296

Class

MandrillMail
Modify the Drupal mail system to use Mandrill when sending emails.

Namespace

Drupal\mandrill\Plugin\Mail

Code

protected function isValidContentType($file_type) {
  $valid_types = array(
    'image/',
    'text/',
    'application/pdf',
    'application/x-zip',
  );
  \Drupal::moduleHandler()
    ->alter('mandrill_valid_attachment_types', $valid_types);
  foreach ($valid_types as $vct) {
    if (strpos($file_type, $vct) !== FALSE) {
      return TRUE;
    }
  }
  return FALSE;
}