public static function WebformAttachmentBase::getFileMimeType in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_attachment/src/Element/WebformAttachmentBase.php \Drupal\webform_attachment\Element\WebformAttachmentBase::getFileMimeType()
Get a webform attachment's file type.
Parameters
array $element: The webform attachment element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
Return value
mixed|string The attachment's file type.
Overrides WebformAttachmentInterface::getFileMimeType
File
- modules/
webform_attachment/ src/ Element/ WebformAttachmentBase.php, line 113
Class
- WebformAttachmentBase
- Provides a base class for 'webform_attachment' elements.
Namespace
Drupal\webform_attachment\ElementCode
public static function getFileMimeType(array $element, WebformSubmissionInterface $webform_submission) {
/** @var \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface $file_mime_type_guesser */
$file_mime_type_guesser = \Drupal::service('file.mime_type.guesser');
$file_name = static::getFileName($element, $webform_submission);
return $file_mime_type_guesser
->guess($file_name);
}