You are here

public function Key::setKeyValue in Key 8

Sets the value of the key.

Parameters

string $key_value: The key value to set.

Return value

string|bool The key value or FALSE if the value could not be set, because the provider does not support setting a key value, for instance.

Overrides KeyInterface::setKeyValue

File

src/Entity/Key.php, line 293

Class

Key
Defines the Key entity.

Namespace

Drupal\key\Entity

Code

public function setKeyValue($key_value) {
  $key_type = $this
    ->getKeyType();
  if ($key_type
    ->getPluginDefinition()['multivalue']['enabled'] && is_array($key_value)) {
    $key_value = $key_type
      ->serialize($key_value);
  }
  $this->keyValue = $key_value;
}