function TestFieldWidgetMultiple::isApplicable

Same name in other branches
  1. 9 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php \Drupal\field_test\Plugin\Field\FieldWidget\TestFieldWidgetMultiple::isApplicable()
  2. 8.9.x core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php \Drupal\field_test\Plugin\Field\FieldWidget\TestFieldWidgetMultiple::isApplicable()
  3. 10 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php \Drupal\field_test\Plugin\Field\FieldWidget\TestFieldWidgetMultiple::isApplicable()

Test is the widget is applicable to the field definition.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition that should be checked.

Return value

bool TRUE if the machine name of the field is not equals to field_onewidgetfield, FALSE otherwise.

Overrides WidgetBase::isApplicable

See also

\Drupal\Tests\field\Functional\EntityReference\EntityReferenceAdminTest::testAvailableFormatters

File

core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php, line 112

Class

TestFieldWidgetMultiple
Plugin implementation of the 'test_field_widget_multiple' widget.

Namespace

Drupal\field_test\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
    // Returns FALSE if machine name of the field equals field_onewidgetfield.
    return $field_definition->getName() != "field_onewidgetfield";
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.