You are here

public function ConfigKeyProvider::getKeyValue in Key 8

Returns the value of a key.

Parameters

\Drupal\key\KeyInterface $key: The key whose value will be retrieved.

Return value

string The key value.

Overrides KeyProviderInterface::getKeyValue

File

src/Plugin/KeyProvider/ConfigKeyProvider.php, line 71

Class

ConfigKeyProvider
Adds a key provider that allows a key to be stored in configuration.

Namespace

Drupal\key\Plugin\KeyProvider

Code

public function getKeyValue(KeyInterface $key) {
  $key_value = isset($this->configuration['key_value']) ? $this->configuration['key_value'] : '';
  if (isset($this->configuration['base64_encoded']) && $this->configuration['base64_encoded'] == TRUE) {
    $key_value = base64_decode($key_value);
  }
  return $key_value;
}