protected function OptionsShsWidget::getSelectedOptions in Simple hierarchical select 2.0.x
Determines selected options from the incoming field values.
Parameters
\Drupal\Core\Field\FieldItemListInterface $items: The field values.
Return value
array The array of corresponding selected options.
Overrides OptionsWidgetBase::getSelectedOptions
File
- src/
Plugin/ Field/ FieldWidget/ OptionsShsWidget.php, line 285
Class
- OptionsShsWidget
- Plugin implementation of the 'options_shs' widget.
Namespace
Drupal\shs\Plugin\Field\FieldWidgetCode
protected function getSelectedOptions(FieldItemListInterface $items) {
$selected_options = [];
foreach ($items as $item) {
$selected_options[] = $item->target_id;
}
return $selected_options;
}