function IFrameUrlHelper::getHash

Same name in other branches
  1. 9 core/modules/media/src/IFrameUrlHelper.php \Drupal\media\IFrameUrlHelper::getHash()
  2. 8.9.x core/modules/media/src/IFrameUrlHelper.php \Drupal\media\IFrameUrlHelper::getHash()
  3. 10 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());
}

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