You are here

protected function ListWidget::getOptions in Select (or other) 4.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/ListWidget.php \Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::getOptions()

Returns the array of options for the widget.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity this widget is used for.

Return value

array The array of available options for the widget. The array of available options for the widget.

Overrides WidgetBase::getOptions

File

src/Plugin/Field/FieldWidget/ListWidget.php, line 50

Class

ListWidget
Plugin implementation of the 'select_or_other_list' widget.

Namespace

Drupal\select_or_other\Plugin\Field\FieldWidget

Code

protected function getOptions(FieldableEntityInterface $entity = NULL) {
  $options = [];
  if ($entity) {
    $options = $this->fieldDefinition
      ->getFieldStorageDefinition()
      ->getOptionsProvider($this
      ->getColumn(), $entity)
      ->getSettableOptions(\Drupal::currentUser());
  }
  return $options;
}