You are here

public static function PollChoiceDefaultWidget::isApplicable in Poll 8

Returns if the widget 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 widget can be used, FALSE otherwise.

Overrides WidgetBase::isApplicable

File

src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php, line 91

Class

PollChoiceDefaultWidget
Plugin implementation of the 'poll_choice_default' widget.

Namespace

Drupal\poll\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  return $field_definition
    ->getTargetEntityTypeId() == 'poll' && $field_definition
    ->getName() == 'choice';
}