public static function VideoPlayerListFormatter::isApplicable in Video 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/VideoPlayerListFormatter.php \Drupal\video\Plugin\Field\FieldFormatter\VideoPlayerListFormatter::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 VideoPlayerFormatter::isApplicable
File
- src/
Plugin/ Field/ FieldFormatter/ VideoPlayerListFormatter.php, line 60
Class
- VideoPlayerListFormatter
- Plugin implementation of the 'video_player_list' formatter.
Namespace
Drupal\video\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
if (empty($field_definition
->getTargetBundle()) && $field_definition
->isList()) {
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());
if ($widget) {
$widget_id = $widget
->getBaseId();
if ($field_definition
->isList() && $widget_id == 'video_upload') {
return TRUE;
}
}
}
return FALSE;
}