public function MediaTypeGuesser::negotiateMediaTypes in Gutenberg 8.2
Same name and namespace in other branches
- 8 src/MediaTypeGuesser.php \Drupal\gutenberg\MediaTypeGuesser::negotiateMediaTypes()
Negotiate which media type should be chosen.
If in guessed media types exist one of the default (existing in the Drupal Core) - choose this one, if not choose first one.
Parameters
array $media_types: Array of found media types.
Return value
string The chosen media type.
1 call to MediaTypeGuesser::negotiateMediaTypes()
- MediaTypeGuesser::guess in src/
MediaTypeGuesser.php - Guesses all media types based on general mime type.
File
- src/
MediaTypeGuesser.php, line 94
Class
- MediaTypeGuesser
- Guesses media type of the file.
Namespace
Drupal\gutenbergCode
public function negotiateMediaTypes(array $media_types) {
if (!$media_types) {
return '';
}
if ($default_media_types = array_intersect($this->defaultMediaTypes, $media_types)) {
return reset($default_media_types);
}
return reset($media_types);
}