function DummyAjaxWidget::formElement
Same name in other branches
- 9 core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldWidget/DummyAjaxWidget.php \Drupal\image_module_test\Plugin\Field\FieldWidget\DummyAjaxWidget::formElement()
- 8.9.x core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldWidget/DummyAjaxWidget.php \Drupal\image_module_test\Plugin\Field\FieldWidget\DummyAjaxWidget::formElement()
- 11.x core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldWidget/DummyAjaxWidget.php \Drupal\image_module_test\Plugin\Field\FieldWidget\DummyAjaxWidget::formElement()
Overrides WidgetInterface::formElement
File
-
core/
modules/ image/ tests/ modules/ image_module_test/ src/ Plugin/ Field/ FieldWidget/ DummyAjaxWidget.php, line 26
Class
- DummyAjaxWidget
- Default widget for Dummy AJAX test.
Namespace
Drupal\image_module_test\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['select_widget'] = [
'#type' => 'select',
'#title' => $this->t('Dummy select'),
'#options' => [
'pow' => 'Pow!',
'bam' => 'Bam!',
],
'#required' => TRUE,
'#ajax' => [
'callback' => static::class . '::dummyAjaxCallback',
'effect' => 'fade',
],
];
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.