You are here

public function ListItemBase::getPossibleValues in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::getPossibleValues()
  2. 10 core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::getPossibleValues()

Returns an array of possible values.

If the optional $account parameter is passed, then the array is filtered to values viewable by the account.

Parameters

\Drupal\Core\Session\AccountInterface $account: (optional) The user account for which to filter the possible values. If omitted, all possible values are returned.

Return value

array An array of possible values.

Overrides OptionsProviderInterface::getPossibleValues

File

core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php, line 33

Class

ListItemBase
Plugin base class inherited by the options field types.

Namespace

Drupal\options\Plugin\Field\FieldType

Code

public function getPossibleValues(AccountInterface $account = NULL) {

  // Flatten options firstly, because Possible Options may contain group
  // arrays.
  $flatten_options = OptGroup::flattenOptions($this
    ->getPossibleOptions($account));
  return array_keys($flatten_options);
}