function ContextualDynamicContextTest::createContextualIdToken

Same name in other branches
  1. 9 core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php \Drupal\Tests\contextual\Functional\ContextualDynamicContextTest::createContextualIdToken()
  2. 8.9.x core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php \Drupal\Tests\contextual\Functional\ContextualDynamicContextTest::createContextualIdToken()
  3. 10 core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php \Drupal\Tests\contextual\Functional\ContextualDynamicContextTest::createContextualIdToken()

Creates a contextual ID token.

Parameters

string $id: The contextual ID to create a token for.

Return value

string The contextual ID token.

2 calls to ContextualDynamicContextTest::createContextualIdToken()
ContextualDynamicContextTest::assertContextualLinkPlaceHolder in core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php
Asserts that a contextual link placeholder with the given id exists.
ContextualDynamicContextTest::testTokenProtection in core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php
Tests the contextual placeholder content is protected by a token.

File

core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php, line 293

Class

ContextualDynamicContextTest
Tests contextual link display on the front page based on permissions.

Namespace

Drupal\Tests\contextual\Functional

Code

protected function createContextualIdToken($id) {
    return Crypt::hmacBase64($id, Settings::getHashSalt() . $this->container
        ->get('private_key')
        ->get());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.