class OptionsProviderBase

Base class for options providers used in Rules actions and conditions.

Hierarchy

Expanded class hierarchy of OptionsProviderBase

File

src/TypedData/Options/OptionsProviderBase.php, line 13

Namespace

Drupal\rules\TypedData\Options
View source
abstract class OptionsProviderBase implements OptionsProviderInterface {
    use StringTranslationTrait;
    
    /**
     * {@inheritdoc}
     */
    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);
    }
    
    /**
     * {@inheritdoc}
     */
    public function getSettableValues(AccountInterface $account = NULL) {
        return $this->getPossibleValues();
    }
    
    /**
     * {@inheritdoc}
     */
    public function getSettableOptions(AccountInterface $account = NULL) {
        return $this->getPossibleOptions();
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
OptionsProviderBase::getPossibleValues public function Returns an array of possible values. Overrides OptionsProviderInterface::getPossibleValues
OptionsProviderBase::getSettableOptions public function Returns an array of settable values with labels for display. Overrides OptionsProviderInterface::getSettableOptions
OptionsProviderBase::getSettableValues public function Returns an array of settable values. Overrides OptionsProviderInterface::getSettableValues
OptionsProviderInterface::getPossibleOptions public function Returns an array of possible values with labels for display. 5
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.