W3cubDocs

/Drupal 8

interface OptionsProviderInterface

Interface for retrieving all possible and settable values.

While possible values specify which values existing data might have, settable values define the values that are allowed to be set by a user.

For example, in an workflow scenario, the settable values for a state field might depend on the currently set state, while possible values are all states. Thus settable values would be used in an editing context, while possible values would be used for presenting filtering options in a search.

For convenience, lists of both settable and possible values are also provided as structured options arrays that can be used in an Options widget such as a select box or checkboxes.

Note that this interface is mostly applicable for primitive data values, but can be used on complex data structures if a (primitive) main property is specified. In that case, the allowed values and options apply to the main property only.

Hierarchy

See also

\Drupal\options\Plugin\Field\FieldWidget\OptionsWidgetBase

File

core/lib/Drupal/Core/TypedData/OptionsProviderInterface.php, line 29

Namespace

Drupal\Core\TypedData

Members

Name Modifiers Type Description
OptionsProviderInterface::getPossibleOptions public function Returns an array of possible values with labels for display.
OptionsProviderInterface::getPossibleValues public function Returns an array of possible values.
OptionsProviderInterface::getSettableOptions public function Returns an array of settable values with labels for display.
OptionsProviderInterface::getSettableValues public function Returns an array of settable values.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!TypedData!OptionsProviderInterface.php/interface/OptionsProviderInterface/8.1.x