You are here

function heartbeat_link_alter in Heartbeat 8

File

./heartbeat.module, line 492
Contains heartbeat.module.

Code

function heartbeat_link_alter(&$variables) {
  if (!is_object($variables['text']) && $variables['text'] === 'Account Settings') {
    $token_service = \Drupal::token();
    $replacement = $token_service
      ->replace($variables['url']
      ->getUri(), [
      \Drupal::currentUser(),
    ]);
    unset($variables['url']);
    $url = Url::fromUserInput('/' . substr($replacement, 5));
    $variables['url'] = $url;
  }
}