You are here

public static function JqueryUIMultiSelectWidget::isApplicable in jQuery UI MultiSelect Widget 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/JqueryUIMultiSelectWidget.php, line 98
Contains \Drupal\jquery_ui_multiselect_widget\Plugin\Field\FieldWidget\JqueryUIMultiSelectWidget.

Class

JqueryUIMultiSelectWidget
Plugin implementation of the 'boolean_checkbox' widget.

Namespace

Drupal\jquery_ui_multiselect_widget\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {

  // Applicable only for items having cardinality more than 1.
  return $field_definition
    ->getFieldStorageDefinition()
    ->isMultiple();
}