public static function VideoJsPlayerFormatter::isApplicable in Video.js (HTML5 Video Player) 8
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
1 method overrides VideoJsPlayerFormatter::isApplicable()
- VideoJsPlayerListFormatter::isApplicable in src/
Plugin/ Field/ FieldFormatter/ VideoJsPlayerListFormatter.php - Returns if the formatter can be used for the provided field.
File
- src/
Plugin/ Field/ FieldFormatter/ VideoJsPlayerFormatter.php, line 193 - Contains \Drupal\videojs\Plugin\Field\FieldFormatter\VideJsPlayerFormatter.
Class
- VideoJsPlayerFormatter
- Plugin implementation of the 'videojs_player' formatter.
Namespace
Drupal\videojs\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
$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 (!$field_definition
->isList()) {
return TRUE;
}
return FALSE;
}