You are here

public function TextInputWidget::isApplicable in Typed Data API enhancements 8

Returns if the widget can be used for the provided data.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $definition: The definition of the edited data.

Return value

bool Whether the data can be edited with the widget.

Overrides FormWidgetInterface::isApplicable

File

src/Plugin/TypedDataFormWidget/TextInputWidget.php, line 43

Class

TextInputWidget
Plugin implementation of the 'text_input' widget.

Namespace

Drupal\typed_data\Plugin\TypedDataFormWidget

Code

public function isApplicable(DataDefinitionInterface $definition) {
  return is_subclass_of($definition
    ->getClass(), StringInterface::class) || is_subclass_of($definition
    ->getClass(), IntegerInterface::class) || is_subclass_of($definition
    ->getClass(), FloatInterface::class);
}