public static function SvgFormatter::isApplicable in SVG Formatter 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
File
- src/
Plugin/ Field/ FieldFormatter/ SvgFormatter.php, line 359
Class
- SvgFormatter
- Plugin implementation of the 'svg_formatter' formatter.
Namespace
Drupal\svg_formatter\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
if ($field_definition
->getType() == 'image') {
$module_handler = \Drupal::service('module_handler');
if ($module_handler
->moduleExists('svg_image')) {
return TRUE;
}
else {
return FALSE;
}
}
return TRUE;
}