OptionsProviderInterface
interface OptionsProviderInterface (View source)
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.
Methods
Returns an array of possible values with labels for display.
Returns an array of settable values with labels for display.
Details
array
getPossibleValues(AccountInterface $account = NULL)
Returns an array of possible values.
If the optional $account parameter is passed, then the array is filtered to values viewable by the account.
array
getPossibleOptions(AccountInterface $account = NULL)
Returns an array of possible values with labels for display.
If the optional $account parameter is passed, then the array is filtered to values viewable by the account.
array
getSettableValues(AccountInterface $account = NULL)
Returns an array of settable values.
If the optional $account parameter is passed, then the array is filtered to values settable by the account.
array
getSettableOptions(AccountInterface $account = NULL)
Returns an array of settable values with labels for display.
If the optional $account parameter is passed, then the array is filtered to values settable by the account.