protected function SparkpostMail::isValidContentType in Sparkpost email 8.2
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 SparkpostMail::isValidContentType()
- SparkpostMail::getAttachmentStruct in src/
Plugin/ Mail/ SparkpostMail.php - Return an array structure for a message attachment.
File
- src/
Plugin/ Mail/ SparkpostMail.php, line 192
Class
- SparkpostMail
- Sparkpost mail plugin.
Namespace
Drupal\sparkpost\Plugin\MailCode
protected function isValidContentType($file_type) {
$valid_types = [
'image/',
'text/',
'application/pdf',
'application/x-zip',
];
// @todo Make this alterable.
foreach ($valid_types as $vct) {
if (strpos($file_type, $vct) !== FALSE) {
return TRUE;
}
}
return FALSE;
}