You are here

protected static function FileMediaFormatterBase::mimeTypeApplies in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::mimeTypeApplies()
  2. 9 core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::mimeTypeApplies()

Check if given MIME type applies to the media type of the formatter.

Parameters

string $mime_type: The complete MIME type.

Return value

bool TRUE if the MIME type applies, FALSE otherwise.

2 calls to FileMediaFormatterBase::mimeTypeApplies()
FileMediaFormatterBase::getSourceFiles in core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php
Gets source files with attributes.
FileMediaFormatterBase::isApplicable in core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php
Returns if the formatter can be used for the provided field.

File

core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php, line 170

Class

FileMediaFormatterBase
Base class for media file formatter.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

protected static function mimeTypeApplies($mime_type) {
  [
    $type,
  ] = explode('/', $mime_type, 2);
  return $type === static::getMediaType();
}