You are here

public function IFrameUrlHelper::getHash in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/IFrameUrlHelper.php \Drupal\media\IFrameUrlHelper::getHash()
  2. 9 core/modules/media/src/IFrameUrlHelper.php \Drupal\media\IFrameUrlHelper::getHash()

Hashes an oEmbed resource URL.

Parameters

string $url: The resource URL.

int $max_width: (optional) The maximum width of the resource.

int $max_height: (optional) The maximum height of the resource.

Return value

string The hashed URL.

File

core/modules/media/src/IFrameUrlHelper.php, line 59

Class

IFrameUrlHelper
Providers helper functions for displaying oEmbed resources in an iFrame.

Namespace

Drupal\media

Code

public function getHash($url, $max_width = NULL, $max_height = NULL) {
  return Crypt::hmacBase64("{$url}:{$max_width}:{$max_height}", $this->privateKey
    ->get() . Settings::getHashSalt());
}