function 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.