7 && $pos = strpos($string, "'s blog", -7)) { $uid = substr($string, 0, $pos); if (is_numeric($uid) && $account = \Drupal\user\Entity\User::load($uid)) { $variables['title'] = [ '#markup' => t("@username's blog", ['@username' => $account->getDisplayName()]) ]; } } } /** * Implements hook_preprocess_HOOK() for comment. * * Shortens and stacks username and submitted date. */ function geofresco_preprocess_comment(array &$variables) { $comment = $variables['elements']['#comment']; if (isset($comment->in_preview)) { $variables['permalink_url'] = new Url(''); } else { $variables['permalink_url'] = $comment->permalink(); } }