protected function SelectOtherWidget::prepareOptions in GatherContent 8.3
Get list of options.
Return value
array Array of options with appended Other option.
1 call to SelectOtherWidget::prepareOptions()
- SelectOtherWidget::formElement in src/
Plugin/ Field/ FieldWidget/ SelectOtherWidget.php - Returns the form for a single field widget.
File
- src/
Plugin/ Field/ FieldWidget/ SelectOtherWidget.php, line 80
Class
- SelectOtherWidget
- Plugin implementation of the 'select_other_widget' widget.
Namespace
Drupal\gathercontent\Plugin\Field\FieldWidgetCode
protected function prepareOptions() {
$list = explode("\n", $this
->getSetting('available_options'));
$options = [];
foreach ($list as $item) {
list($key, $value) = explode('|', $item);
$value = html_entity_decode($value);
$options[$key] = $value;
}
return $options + [
'other' => $this
->t('Other'),
];
}