Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / field / tests / modules / field_test / src / Plugin / Field / FieldWidget / TestFieldWidgetMultilingual.php
diff --git a/web/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php b/web/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php
new file mode 100644 (file)
index 0000000..aabc74e
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Drupal\field_test\Plugin\Field\FieldWidget;
+
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Plugin implementation of the 'test_field_widget_multilingual' widget.
+ *
+ * @FieldWidget(
+ *   id = "test_field_widget_multilingual",
+ *   label = @Translation("Test widget - multilingual"),
+ *   field_types = {
+ *     "test_field",
+ *   },
+ * )
+ */
+class TestFieldWidgetMultilingual extends TestFieldWidget {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL) {
+    $elements = parent::form($items, $form, $form_state, $get_delta);
+    $elements['#multilingual'] = TRUE;
+    return $elements;
+  }
+
+}