TestFieldWidgetMultilingual.php

Same filename in other branches
  1. 8.9.x core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php
  2. 10 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php
  3. 11.x core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php

Namespace

Drupal\field_test\Plugin\Field\FieldWidget

File

core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php

View source
<?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;
    }

}

Classes

Title Deprecated Summary
TestFieldWidgetMultilingual Plugin implementation of the 'test_field_widget_multilingual' widget.

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