public static function InstagramEmbedFormatter::isApplicable in Media entity Instagram 3.x
Returns if the formatter can be used for the provided field.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition that should be checked.
Return value
bool TRUE if the formatter can be used, FALSE otherwise.
Overrides OEmbedFormatter::isApplicable
File
- src/
Plugin/ Field/ FieldFormatter/ InstagramEmbedFormatter.php, line 141
Class
- InstagramEmbedFormatter
- Plugin implementation of the 'instagram_embed' formatter.
Namespace
Drupal\media_entity_instagram\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
if (parent::isApplicable($field_definition)) {
$media_type = $field_definition
->getTargetBundle();
if ($media_type) {
$media_type = MediaType::load($media_type);
return $media_type && $media_type
->getSource() instanceof Instagram;
}
}
return FALSE;
}