You are here

public function UpdateHelper::setKey in Evercurrent 8.2

Same name and namespace in other branches
  1. 8 src/UpdateHelper.php \Drupal\evercurrent\UpdateHelper::setKey()

Check a key and set it if valid.

Parameters

string $key: The key to set.

Return value

bool Success status.

File

src/UpdateHelper.php, line 259

Class

UpdateHelper
Default UpdateHelper instantiation.

Namespace

Drupal\evercurrent

Code

public function setKey($key) {
  $config = $this->configFactory
    ->getEditable('evercurrent.admin_config');
  if ($this
    ->keyCheck($key)) {
    $config
      ->set('key', $key);
    return TRUE;
  }
  $this
    ->writeStatus(RMH_STATUS_ERROR, 'Failed to set RMH key. Key should be a 32-character string.');
  return FALSE;
}