public static function VideoEmbedPlayerFormatter::isApplicable in Video 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/VideoEmbedPlayerFormatter.php \Drupal\video\Plugin\Field\FieldFormatter\VideoEmbedPlayerFormatter::isApplicable()
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 FormatterBase::isApplicable
File
- src/
Plugin/ Field/ FieldFormatter/ VideoEmbedPlayerFormatter.php, line 153
Class
- VideoEmbedPlayerFormatter
- Plugin implementation of the video field formatter.
Namespace
Drupal\video\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
if (empty($field_definition
->getTargetBundle())) {
return TRUE;
}
else {
$entity_form_display = entity_get_form_display($field_definition
->getTargetEntityTypeId(), $field_definition
->getTargetBundle(), 'default');
$widget = $entity_form_display
->getRenderer($field_definition
->getName());
$widget_id = $widget
->getBaseId();
if ($widget_id == 'video_embed') {
return TRUE;
}
}
return FALSE;
}