You are here

public static function Settings::getHashSalt in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::getHashSalt()

Gets a salt useful for hardening against SQL injection.

Return value

string A salt based on information in settings.php, not in the database.

Throws

\RuntimeException

19 calls to Settings::getHashSalt()
ContextualController::render in core/modules/contextual/src/ContextualController.php
Returns the requested rendered contextual links.
ContextualDynamicContextTest::createContextualIdToken in core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php
Creates a contextual ID token.
ContextualLinksPlaceholder::preRenderPlaceholder in core/modules/contextual/src/Element/ContextualLinksPlaceholder.php
Pre-render callback: Renders a contextual links placeholder into #markup.
CsrfTokenGenerator::computeToken in core/lib/Drupal/Core/Access/CsrfTokenGenerator.php
Generates a token based on $value, the token seed, and the private key.
DisplayBlockTest::testBlockContextualLinks in core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
Tests the contextual links on a Views block.

... See full list

File

core/lib/Drupal/Core/Site/Settings.php, line 190

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

public static function getHashSalt() {
  $hash_salt = self::$instance
    ->get('hash_salt');

  // This should never happen, as it breaks user logins and many other
  // services. Therefore, explicitly notify the user (developer) by throwing
  // an exception.
  if (empty($hash_salt)) {
    throw new \RuntimeException('Missing $settings[\'hash_salt\'] in settings.php.');
  }
  return $hash_salt;
}