Answer the question
In order to leave comments, you need to log in
How to create widget select2 for Drupal8?
How to create widget select2 for Drupal8?
I want to make a list of currencies with flags according to my table
Installed using the command composer require select2/select2
In the widget for formElement I write:
. . .
$element += [
'#type' => 'select2',
'#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : '',
'#size' => 1,
'#maxlength' => 255,
'#options' => $options,
'#options_attributes' => $options_attributes,
'#empty' => $this->t('No currencies found'),
'#element_validate' => [
[$this, 'CurrencyValidation'],
],
];
. . .
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question